Stop using useContext, Start using `use`
Modern react comes with a new top level API (starting with React 19) called use.
It provides a number of features, but a key one is that it can resolve a context value similar to useContext
.
Additionally use
is better than useContext
because you can call it conditionally (and even in loops). This makes use
better (more flexible) than useContext
Want a demo? You can watch this Pro lesson and find code examples you can run in your browser. Free for 24 hours 🫰🏻
React use API vs useContext
Lesson from "Professional React": React use API vs useContext
Special Discount Code 🤫
As always, here is a special gift for you as an email subscriber…
Discount Code: launchparty (50% off the launch price for life).
Don't miss what's next. Subscribe to Boolean Art: