View profile

Become proficient with React Hooks


Robin Wieruch - A Developer's Newsletter

April 30 · Issue #21 · View online

Hello, it's Robin. I am the author of books such as The Road to React and much more content about JavaScript and its ecosystem.

This is my newsletter which delivers comprehensive tutorials, books, and courses straight to your inbox. Quality content only. Give it a chance and become a better developer every month.

Hi there, it’s Robin. I am happy to see so many people picking up The Road to React || GraphQL || Firebase this year. There are lots of things changing in React at the moment, having React Hooks released, but still waiting for this other feature called React Suspense. Once this missing piece is released in React, I will dive into the great rewrite marathon for all my books. Until then, I will write enthusiastically about the new features on my blog. If you cannot wait for the new book releases, read through my latest tutorials to learn about React Hooks right now.

State Management with React Hooks
In the React world, after learning React, the advice has always been to learn Redux. Now I’d argue this becomes only true if you deal with large size applications that have complex state management scenarios. With React itself, you can implement powerful state management yourself with State, Reducer, and Context Hooks. I strongly believe this will become common sense for React applications. Follow the tutorial to learn more about all three Hooks while building one predictable and maintainable React application yourself.
What should I use: useState or useReducer?
With all the new built-in Hooks released for React, it’s not easy to tell when to use which Hook. Both useState and useReducer hooks are used for state management. Only time will tell which one to use for different state management scenarios, but I have come up with a great comparison that should guide you when to use useState or useReducer for your React application. Afterwards, you should be well aware of when to transition from a useState hook to a useReducer hook.
Reducers in React without Redux?
Reducers are a concept mainly known for Redux. Now you can use them in React with the new useReducer Hook. If you haven’t learned about Redux yet, this concept may be new to you. That’s why I wrote about Reducers in JavaScript and the new Reducer Hook for React in detail. After reading both tutorials, you should be set up for Reducers in React without any Redux.
React Hooks change how we will write React applications in the future. All my tutorials are designed to give you a great experience to learn about them. If you don’t have enough yet, check out how to implement the popular game called Snake with React Hooks or how to interact with the local storage with React Hooks to synchronize your state with the browser.
That’s it from my side. I hope all the content is interesting to you. See you again with a lot more React and JavaScript next time! Best, Robin
PS.: As always, I am super happy about your nice reviews on Amazon. If you have read one of my books and it had an impact on you, it would mean the world to me if you head over and leave your feedback there.
Book Recommendation
The last book I read was Company of One. It aligned with my values, because even though I started being self-employed two years ago, I never really wanted to grow a large company myself. Staying small as a company, being just one or a few persons, allows me to have focused work time and happy leisure time with family and friends.
Did you enjoy this issue?
In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Powered by Revue