PokeVideoPlayer v0.9-rev1 - licensed under gpl3-or-later
Views : 195,227
Genre: Science & Technology
Feb 25, 2023 ^^
warning: returnyoutubedislikes may not be accurate, this is just an estiment ehe :3
Rating : 4.777 (486/8,243 LTDR)
94.43% of the users lieked the video!!
5.57% of the users dislieked the video!!
User score: 91.65- Overwhelmingly Positive
RYD date created : 2024-06-18T09:24:43.682518Z
See in json
Top Comments of this video!! :3
Its not a hook, its a signal implementation
react what does there instead is save the state outside from the function, so when the hook runs again (when a component rerenders) it gets the new state.
Something like this
```js
let state = 0 ;
function useState(s) {
state = state || s
const setState = (setter) => {
state = setter(state)
}
return [state, setState]
}
const [count, setCount] = useState(1);
console.log("initial state", count);
setCount((n) => n + 1);
console.log("stale state", count);
// rerender
const [count2, setCount2] = useState(1);
console.log("changed state", count2);
```
13 |
@FERnandezJjuan
1 year ago
That it’s not a HOOKk it’s just an state manager, it’s just taking advantage of closure
158 |