The reduce pattern useReducer is a React hook that helps to apply functional programming reduce pattern to managing the state of React UI component. The idea is to use reduce function to model a UI. Remember the reduce function from JavaScript? Here is an example of how to calculate an array’s total using reduce. It…Continue Reading “The useReducer hook: making React components testable and maintainable”

This article might be useful to you if you need to dispatch Redux actions from your custom hooks. Unfortunately currently Redux’s useDispatch is in alpha and this is not a good idea to use alpha version of the library in the production. First, we need to create a context as we need to be able…Continue Reading “Implementing useDispatch hook without installing alpha versions of Redux”

React hooks can be controversial. Some people are excited about them but others are cautious. Hooks are new and it is not clear if they will stick and whether they will not degrade the project qualities like consistency or performance. But you are sure that hooks are the way to go. However, hooks cannot be…Continue Reading “Learn how to convince colleagues to use React hooks in your full-of-classes project so that they become excited themselves”