Concepts

JavaScript closures in React callbacks

A function retains access to bindings in its lexical environment. Render-specific bindings explain why callbacks can observe older render snapshots.

Formal Syntax & Structure

react syntaxreact
JavaScript closures in React callbacks

Working Example

Example Snippetreact
function makeFormatter(prefix) { return name => prefix + name; }
React Reference