ReactBeginner#props#state

Difference between props and state?

Props are read-only inputs passed from the parent and make a component reusable. State is data owned and mutated by the component itself; updating it re-renders the component.

Example
function Counter({ step }) {         // prop
  const [n, setN] = useState(0);      // state
  return <button onClick={() => setN(n + step)}>{n}</button>;
}

Related Questions

1
ReactIntermediate#forms

What are controlled and uncontrolled components?

Open
2
ReactIntermediate#fundamentals#performance

What is the virtual DOM and reconciliation?

Open
3
ReactBeginner#lists

Why do lists need keys?

Open