State
Object state replacement
Replace a state object with a fresh value, preserving fields that should remain.
Formal Syntax & Structure
react syntaxreact
setState(old => ({ ...old, field: value }))Working Example
Example Snippetreact
setDelivery(d => ({ ...d, express: true }))