We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const useState = (initState) => { const reducer = (prev, action) => { return typeof action === "function" ? action(prev) : action; }; return useReducer(reducer, initState); };
const useReducer = (reducer, initState) => { const [state, setState] = useState(initState); const dispatch = (action) => { setState((prev) => reducer(prev, action)); }; return [state, dispatch]; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
useReducer 实现 useEffect
useEffect 实现 useReducer
The text was updated successfully, but these errors were encountered: