In earlier versions of React, you were required to use classes if you needed to manage state. Now with hooks that isn’t the case. Let’s explore the options
You can write React components in two ways: As a function, or as a class. It can be confusing to understand which you should use and why. For devs brand new to React, they may not understand the history and recent changes between the two. If you ask online, everyone says to use function components. However, almost every tutorial, even the official documentation, favors classes. Why the divide?
Part of the class components to function components series. In earlier versions of React, one of the biggest downsides to using function components over class components was that you could not use life cycle methods. What if you need to do something when your component mounts, like fetch some data or set some initial state? […]
There are situations where you do want to share state between multiple components, and you may not want to bring Redux into your architecture. In this tutorial, you’ll learn how to create your own mini-state management system.
If you are using class components, but want to use hooks, you can’t do so directly. One strategy for adding them is to use adapter components. Another strategy is to use higher-order components to pass along data from hooks as props. Here’s how
When the react-redux team released version 7.1.0, they added hooks to react-redux! Here’s a quick comparison of how it could change how you write components. First, a brief overview of the new toys useSelector: Pass in a function that takes the state as an argument and returns a value. Used to get a single value […]