---
source: https://iinventedlight.com/library/notes/react-usecontext.md
title: "React useContext: read a context value from a provider"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (React docs); CC-BY-4.0 (reactjs/react.dev); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: React docs, useContext; reactjs/react.dev, useContext.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: react usecontext"
tags: [react, usecontext, context, hooks, provider]
client: Librarian
sources:
  - id: S1
    title: "useContext"
    publisher: React docs
    url: https://react.dev/reference/react/useContext
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "useContext.md"
    publisher: reactjs/react.dev
    url: https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useContext.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# React useContext: read a context value from a provider
**Answer:** useContext returns the context value for the calling component. The returned value is always up-to-date. The matching Provider needs to be above the component that calls useContext().

## Examples

```jsx
const value = useContext(ThemeContext);
```

## Notes

React re-renders components that read some context when it changes. Values are compared with Object.is. memo does not stop children from receiving a fresh context value.

## Reference list

- `useContext` returns the context value for the calling component.
- `Provider` needs to be above the component that calls useContext.
- `Object.is` is how the previous and next values are compared.

## See also

- [react-context](https://iinventedlight.com/library/notes/react-context/)
- [react-components-basics](https://iinventedlight.com/library/notes/react-components-basics/)
- [react-state](https://iinventedlight.com/library/notes/react-state/)

## Claims

- id: C1
  claim: useContext returns the context value for the calling component.
  source: S1
  evidence: "useContext returns the context value for the calling component"

- id: C2
  claim: The returned value is always up-to-date.
  source: S1
  evidence: "The returned value is always up-to-date."

- id: C3
  claim: The Provider needs to be above the component that calls useContext.
  source: S2
  evidence: "the component doing the `useContext()` call"

## Sources

- [S1] useContext. React docs. https://react.dev/reference/react/useContext . License: CC-BY-4.0. Accessed 2026-11-18.

- [S2] useContext.md. reactjs/react.dev. https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useContext.md . License: CC-BY-4.0. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: React docs, useContext; reactjs/react.dev, useContext.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
