FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

25 snippets foundClear filters
ReactGetting Started

Append to an array without mutating state

Append to an array without mutating state with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Assign a CSS class in JSX

Assign a CSS class in JSX with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Calculate a value inside JSX

Calculate a value inside JSX with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Choose between two render branches

Choose between two render branches with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Compose content through children

Compose content through children with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Control a checkbox

Control a checkbox with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Control a select element

Control a select element with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Control a text input

Control a text input with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Disable an unavailable action

Disable an unavailable action with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Display a JavaScript value in JSX

Display a JavaScript value in JSX with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Group siblings with a fragment

Group siblings with a fragment with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Handle a button click

Handle a button click with a small React component and explicit browser behavior.

React✓ Tested