Tsallaka zuwa abun ciki
Justice Tech School

Context

Context passes data deep without prop drilling.

Example
const Theme = createContext("light");
function App() {
  return <Theme.Provider value="dark"><Deep /></Theme.Provider>;
}
function Deep() {
  const t = useContext(Theme);
  return <p>{t}</p>;
}

Exercise

Read context.

(Theme)

Quiz Test

What problem does context solve?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.