initial
This commit is contained in:
commit
74ae93a96e
1 changed files with 94691 additions and 0 deletions
14
joplin notion extension/Web Development/React/Basics.md
Normal file
14
joplin notion extension/Web Development/React/Basics.md
Normal 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
|
||||
Loading…
Reference in a new issue