The snippet library.
Small, practical examples. Search by task or narrow things down below.
Defer the value used by a result panel
Defer the value used by a result panel with a small React component and explicit browser behavior.
React✓ Tested
Keep a callback stable between renders
Keep a callback stable between renders with a small React component and explicit browser behavior.
React✓ Tested
Mark a nonurgent state update as a transition
Mark a nonurgent state update as a transition with a small React component and explicit browser behavior.
React✓ Tested
Memoize a component with stable props
Memoize a component with stable props with a small React component and explicit browser behavior.
React✓ Tested
Memoize a derived collection
Memoize a derived collection with a small React component and explicit browser behavior.
React✓ Tested
Memoize a sorted copy of state
Memoize a sorted copy of state with a small React component and explicit browser behavior.
React✓ Tested
Memoize an object passed to a provider
Memoize an object passed to a provider with a small React component and explicit browser behavior.
React✓ Tested
Mount expensive content only when requested
Mount expensive content only when requested with a small React component and explicit browser behavior.
React✓ Tested
Render a bounded preview of a long list
Render a bounded preview of a long list with a small React component and explicit browser behavior.
React✓ Tested
Subscribe to a small external store safely
Subscribe to a small external store safely with a small React component and explicit browser behavior.
React✓ Tested