This commit is contained in:
nm1 2026-11-04 00:33:23 +05:30
commit 74ae93a96e

View file

@ -0,0 +1,14 @@
Basics
```js
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