-
Book Overview & Buying
-
Table Of Contents
Designing React Hooks the Right Way
By :
We really did a lot in this chapter. First, we got to know what a side effect is, and we dug deeper into the useEffect hook's design. We discovered how an effect can be created and then later invoked after a UI update. We also learned about various scenarios for creating effects based on dependency arrays. After that, we walked through the pitfalls of using useEffect with missing dependencies, staled values, and infinite loops. Last but not least, we learned to apply useEffect in practical components, such as the examples of finding the window size in a browser and fetching API resources from an online server.
In the next chapter, we will discover our next hook in the React family and focus on how to apply an optimization to boost performance by using values from a previous update.
Change the font size
Change margin width
Change background colour