An Interest In:
Web News this Week
- April 29, 2024
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
June 26, 2019 01:59 pm GMT
Original Link: https://css-tricks.com/getting-to-know-the-usereducer-react-hook/
Getting to Know the useReducer React Hook
useReducer
is one of a handful of React hooks that shipped in React 16.7.0. It accepts a reducer function with the application initial state, returns the current application state, then dispatches a function.
Here is an example of how it is used;
const [state, dispatch] = useReducer(reducer, initialState);
Whats the good for? Well, think about any situation where having the first loaded state of the application might be nice. Lets say the starting point on an interactive map. Maybe its … Read article
The post Getting to Know the useReducer React Hook appeared first on CSS-Tricks.
Original Link: https://css-tricks.com/getting-to-know-the-usereducer-react-hook/
Share this article:
Tweet
View Full Article