-
Book Overview & Buying
-
Table Of Contents
Designing React Hooks the Right Way
By :
Here are some questions and answers to refresh your knowledge:
useMemo?A useMemo hook is an assignment statement where a new value is created when one of the dependencies changes. It can be used to minimize the creation of a value, so it behaves like that sometimes when an assignment is "skipped."
useMemo?It's mainly used as an optimization to avoid heavy operation on every render otherwise. If a certain evaluation is excessively used, thus blocking the UI, it is the right time to think about using useMemo to limit the usage to only relevant conditions. For instance, if typing isn't related to that task, we can take it out of the dependency list.
useMemo for memorization?useMemo doesn't remember all past values and only remembers the last created value. So, the best usage of it is to use it as a special assignment replacement, instead of a caching mechanism.
Change the font size
Change margin width
Change background colour