Problems

Nearest Context Provider

MediumReact Hooks

useContext reads the NEAREST provider above. Input: line 1 — JSON array of providers from root to the component, each {"value": string} (may be empty); line 2 — the default context value. Print what useContext returns.

Input: two lines. Output: the context value.

Your program reads from stdin and prints to stdout.

Example 1

Input: [{"value":"dark"},{"value":"light"}] system

Output: light

Hints

ReactHooksuseContext
Nearest Context Provider | CodeForge AI