react-doctor/prefer-use

Replace useContext(Context) with the React 19 use(Context) API, which reads the same value but may be called conditionally

Validation prompt

Use this to decide whether a fired diagnostic is real or a false positive.

Fires on a useContext(SomeContext) call (analogous to eslint-react no-use-context), recommending the React 19 use(SomeContext) API, which reads the same context value but may be called inside conditionals and loops rather than only at the component top level. Only meaningful on React 19+ projects; use() is unavailable before 19. False positive: a useContext re-exported through a custom wrapper hook, where the migration belongs at the wrapper definition rather than each call site.

Fix prompt

Use this once validation confirms the diagnostic is real.

Swap useContext for use at the call site: const theme = use(ThemeContext) replaces const theme = useContext(ThemeContext). Remove the useContext import only if no other useContext usage remains in the file. Unlike useContext, use may be called conditionally, so the read can move inside the branch that needs it. See https://react.dev/reference/react/use