react hooks自2019年1月发布以来已通过去快一年了,苦于没有练手项目吗?在这里我将为你们分享一些简单易懂的hook实战demo,后面的demo复杂度会慢慢增长。react
一个简单的评分组件git
难易程度: ⭐github
在线预览npm
源码地址json
一个简单的计数器,能够'加一','减一'和'重置'bash
git clone git@github.com:tangweikun/happy-beauty-stars.git
复制代码
cd happy-clicker
yarn | npm install
复制代码
yarn start | npm run start
复制代码
homepage
到 package.json
"homepage": "https://myusername.github.io/my-app",
复制代码
gh-pages
yarn add gh-pages
复制代码
package.json
中添加部署脚本"scripts": {
+ "predeploy": "npm run build",
+ "deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
复制代码
yarn deploy
yarn deploy
复制代码
https://myusername.github.io/my-app
查看效果