My Two Favorite React Tricks
Published 📅: ....
Last modified 📝: ....
Share this post on BlueskySee discussion on Bluesky
There are generally two rarely used patterns in React that I really enjoy getting to use in applications that I work on.
These both are:
- Using
key - Throwing within a state setter
On Key
In React, key is one of those early concepts that you learn that seems to only
be documented for use within lists. However it is an incredibly useful feature
that most developers don't use when building applications!
If you ever find yourself realizing that you need to reset the state, or refs, of a particular component based on some value in the parent a that can be changed on the component is a really useful way to do so!