Promptles
React & Frontend

Context

intermediate

Definition

A way to share information across an entire app without passing it through every single building block by hand. It's like setting one master switch, for the theme, the logged-in user, the chosen language, that any part of the app can read whenever it needs to.

In the wild

A user picks 'dark mode' in the settings. Instead of telling every button, every menu, and every page about it one by one, the app stores the choice in a context. Every block of the app simply reads the context and styles itself accordingly.

More from React & Frontend