How do you share state without prop drilling?
Simple meaning
For low-frequency data like theme or auth user, Context is enough.
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready Frontend Master questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
For low-frequency data like theme or auth user, Context is enough.
Open the full page for Why, Steps, Example and Key takeaway.
Context re-renders all consumers when the provider value changes, so putting a rapidly updating cart in a huge provider is costly.
Open the full page for Why, Steps, Example and Key takeaway.
Controlled means every keystroke goes through React state, which is required for instant validation and disabling submit.
Open the full page for Why, Steps, Example and Key takeaway.
Only call hooks at the top level of a React function, not in loops or conditions, so the order stays stable.
Open the full page for Why, Steps, Example and Key takeaway.
React relies on call order to match state cells.
Open the full page for Why, Steps, Example and Key takeaway.
The UI dispatches an action object.
Open the full page for Why, Steps, Example and Key takeaway.
A reducer is a function of previous state and action that returns the next state.
Open the full page for Why, Steps, Example and Key takeaway.
Classic Redux needed hand-written action types, switch statements, and spread copies.
Open the full page for Why, Steps, Example and Key takeaway.
GetStaticProps builds HTML at build time, great for marketing pages.
Open the full page for Why, Steps, Example and Key takeaway.
The HTML from the server does not equal what React renders on the client for the first pass.
Open the full page for Why, Steps, Example and Key takeaway.
They catch errors during render, lifecycle, and constructors of children via componentDidCatch.
Open the full page for Why, Steps, Example and Key takeaway.
A custom hook is a function starting with use that calls other hooks, so I can reuse stateful logic.
Open the full page for Why, Steps, Example and Key takeaway.
React 18 batches setState in timeouts, promises, and native events so one event loop turn can become one render.
Open the full page for Why, Steps, Example and Key takeaway.
Middleware wraps dispatch so I can log, crash-report, or run async.
Open the full page for Why, Steps, Example and Key takeaway.
A layout wraps child routes and does not remount on navigation inside that segment, so shared chrome stays mounted.
Open the full page for Why, Steps, Example and Key takeaway.
Fiber is a linked list of work units so React can pause, reuse, and prioritize updates instead of one long recursive stack.
Open the full page for Why, Steps, Example and Key takeaway.
It lets React prepare a new tree in the background without blocking typing.
Open the full page for Why, Steps, Example and Key takeaway.
React 18 Strict Mode mounts, unmounts, and remounts to surface missing cleanup.
Open the full page for Why, Steps, Example and Key takeaway.
I include the value in the dependency array, or I read it from a ref that I update every render.
Open the full page for Why, Steps, Example and Key takeaway.
Server data goes in a cache like React Query with keys per widget.
Open the full page for Why, Steps, Example and Key takeaway.