React 是主流的前端框架,v16.8 版本引入了全新的 API,叫做 React Hooks,颠覆了以前的用法。

阅读本文需要有 React 基础。如果你还没学会 React,可以先看一下它的教程

 

 React Hooks 项目搭建

1, npm install -g create-react-app
2, create-react-app react-hooks1  (为项目名)
3, cd react-hooks1
4, npm install
5, npm start

npm run build 项目打包,生成build文件夹

 

create-react-app安装依赖项
npm install
例如: npm install classnames     安装本地依赖,不会修改package.json
https://www.jianshu.com/p/920c1a6e999c

例如,React Router:
npm install --save react-router-dom  安装依赖,会修改package.json,添加新的依赖项
npm install --save react-redux
npm install --save style-loader
npm install --save sass-loader

https://www.jianshu.com/p/324fd1c124ad/

 

学习链接:https://www.jianshu.com/p/7e778adec7d1

     http://www.ruanyifeng.com/blog/2019/09/react-hooks.html  阮一峰教程

     https://www.imooc.com/article/288292?block_id=tuijian_wz

     https://www.jianshu.com/p/566f0d79ca7b

     https://www.cnblogs.com/crazycode2/p/11761000.html

相关文章:

  • 2022-01-09
  • 2021-12-03
  • 2022-12-23
  • 2022-03-04
  • 2022-02-26
  • 2021-05-27
猜你喜欢
  • 2018-02-09
  • 2021-10-21
  • 2021-12-31
  • 2022-02-04
  • 2022-12-23
相关资源
相似解决方案