joplin-notes/joplin notion extension/Web Development/React/Basics.md
2026-11-04 00:33:23 +05:30

317 B

Basics

const [name, setName] = useState('Edward');
const [age, setAge] = useState('0');


function handleClick() {
  setName('Taylor');
  setAge(a => a + 1);
}

as react batches states updates so it when it is called multiple times it may not update correctly so this updater function/functional form helps