Keeping React components pure
Pure functions only perform a calculation and nothing more. [S1]
Purity rules
Given the same inputs, a pure function should always return the same result. [S1]
A pure function does not change any objects or variables that existed before it was called. [S1]
React rendering expects component functions to behave like pure functions with respect to their props and state. [S1]
State as a snapshot
However, state behaves more like a snapshot. [S2]
Setting state requests a re-render; the event handler sees the state from the render that created it. [S2]
Claims
- id: C1 claim: Pure functions only calculate. source: S1 evidence: "Pure functions only perform a calculation and nothing more."
- id: C2 claim: Same inputs yield the same output. source: S1 evidence: "should always return the same result"
- id: C3 claim: Pure functions do not mutate prior data. source: S1 evidence: "does not change any objects or variables that existed before it was called"
- id: C4 claim: State behaves like a snapshot. source: S2 evidence: "state behaves more like a snapshot"
Sources
- [S1] Keeping Components Pure – React. React docs (react.dev). https://react.dev/learn/keeping-components-pure . License: CC BY 4.0 (reactjs/react.dev LICENSE-DOCS). Accessed 2026-11-06.
- [S2] State as a Snapshot – React. React docs (react.dev). https://react.dev/learn/state-as-a-snapshot . License: CC BY 4.0 (reactjs/react.dev LICENSE-DOCS). Accessed 2026-11-06.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: React docs (react.dev), Keeping Components Pure – React, CC BY 4.0 (reactjs/react.dev LICENSE-DOCS); React docs (react.dev), State as a Snapshot – React, CC BY 4.0 (reactjs/react.dev LICENSE-DOCS).
Cite this
iinventedlight. 2026. "Keeping React components pure." iinventedlight Library, iil:note:fp1xt1ry, version of 2026-11-06. https://iinventedlight.com/library/notes/react-pure-components/. License: CC-BY-4.0.
@misc{iil_note_fp1xt1ry,
author = {{iinventedlight}},
title = {{Keeping React components pure}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-06},
url = {https://iinventedlight.com/library/notes/react-pure-components/},
note = {Permanent ID iil:note:fp1xt1ry. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/react-pure-components.md.