useReducerを使ってuseStateを独自に実装function useState(initialValue) { let [state, dispatch] = useReducer((state, action) => { return action }, initialValue) return [state, dispatch] } |
|
useReducerを使ってuseStateを独自に実装function useState(initialValue) { let [state, dispatch] = useReducer((state, action) => { return action }, initialValue) return [state, dispatch] } |
|