JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q19972F
  • License MIT

Package Exports

  • @zxuqian/react-examples

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zxuqian/react-examples) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

这个项目是我 B 站视频教程中,有关 React 的示例代码。我把组件打包成了单独的组件,可以在安装这个库之后直接导入使用。

点击查看运行示例

点击查看 B 站个人主页

如何使用

这个示例项目是由 Create-React-App 工具创建的,只导出了组件相关的部分,所以需要自己安装一下 React 相关的依赖。如果你的项目也是用 CRA 创建的,那么就不用做任何操作了~

首先安装本库:

npm i @zxuqian/react-examples

yarn add @zxuqian/react-examples

导入一个组件

import { Gradient } from "@zxuqian/react-examples";

使用组件

直接像往常一样使用组件就好:

export default function GradientDemo() {
  return (
    <div style={{ height: "50vh" }}>
      <Gradient />
    </div>
  );
}