Today in the Meta Frontend Developer Course I learned about React Context. Context in React is a way of having props that are accessible everywhere in your app. This solves a problem known as "prop drilling" where you have to pass props through a long chain of parent and child components. Context eliminates the need for prop drilling and allows certain global props to be accessible everywhere. One of the common uses for context is for an app theme, like light and dark mode for example. This way when the theme prop is toggled, the context provides the prop to any component that needs it and they can render themselves accordingly. However, the best practice is to keep your context as lean as possible and only use it when it really makes sense for the app design.
Subscribe to:
Post Comments (Atom)
190: Sablier
The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...
-
The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...
-
The ZKasino project recently exit scammed over 33 million dollars worth of Ethereum. he recent debacle surrounding ZKasino offers valuable...
-
In addition to its native SDK, Hedera also supports smart contracts in a platform compatible with the Ethereum Virtual Machine. This allows ...
No comments:
Post a Comment