GitHub: https://github.com/wubaiqing/zaobao
[类库] 一个非常可爱的 React 卡通人脸库,很有意思:https://github.com/miukimiu/react-kawaii
[类库] immer 的 React Hooks 版:https://github.com/immerjs/use-immer
[工具] yarn-lock-cli 可以直接修改 yarn.lock 文件中的源地址:https://github.com/kokororin/yarn-lock-cli
[工具] mirror-config-china 是为中国内地的 Node.js 开发者准备的镜像配置,大大提高 Node 模块安装速度,不仅有淘宝,还有清华等镜像源地址:https://github.com/gucong3000/mirror-config-china
npm i -g mirror-config-china --registry=https://registry.npm.taobao.org
# 查看 npm 配置
npm config list
# 查看环境变量
source ~/.bashrc && env
import React from "react";
import { useImmerReducer } from "use-immer";
const initialState = { count: 0 };
function reducer(draft, action) {
switch (action.type) {
case "reset":
return initialState;
case "increment":
return void draft.count++;
case "decrement":
return void draft.count--;
}
}
function Counter() {
const [state, dispatch] = useImmerReducer(reducer, initialState);
return (
<>
Count: {state.count}
<button onClick={() => dispatch({ type: "reset" })}>Reset</button>
<button onClick={() => dispatch({ type: "increment" })}>+</button>
<button onClick={() => dispatch({ type: "decrement" })}>-</button>
</>
);
}
In
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
react@^15.6.1:
version "15.6.2"
resolved "http://registry.npm.taobao.org/react/download/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72"
Out
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
react@^15.6.1:
version "15.6.2"
resolved "https://registry.npmjs.org/react/-/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72"
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.