react hooks自2019年1月發佈以來已通過去快一年了,苦於沒有練手項目嗎?在這裏我將爲你們分享一些簡單易懂的hook實戰demo,後面的demo複雜度會慢慢增長。react
點擊方塊小遊戲git
難易程度: ⭐github
在線預覽npm
源碼地址json
一個簡單的計數器,能夠'加一','減一'和'重置'bash
一個簡單的評分組件post
git clone git@github.com:tangweikun/happy-find-square-game.git
複製代碼
cd happy-find-square-game
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
查看效果