Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 26, 2019 01:59 pm GMT

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:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks