React Hooks Explained
useHistory, useRef, and useEffect
It’s been a while since the last email, but I’m finally back with a few new articles.
This time, instead of writing one long-form article, I decided to split them up. So instead of one, I have three articles that you can check out.
If you’re interested in learning more about React hooks, I might write a more in-depth article on the topic.
The useRef hook is probably one of the most misunderstood hooks out there. From its name, it’s not quite clear what it should be used for. In the article, I go into the use cases of this hook, including when you shouldn’t use it.
This will be one of the first hooks you’ll use if you get started. The reason why it is so powerful: It allows you to write code that executes before the component unmounts, updates, or re-renders, which makes it a good replacement for the lifecycle functions we know from class components.
Learn how to use this hook, provided by react-router, to programmatically access the browser history and change the user’s location in your functional components.
I tagged these shorter articles with the tag “snippet”. You can check them all out on my website if you click on the button.
Have a nice week and see you next time!