LBRY Block Explorer

LBRY Claims • reactjs-pitfalls-2-using-usestate

12ae5b41fcb9e442ca50cfec171b638d50cc0ff6

Published By
Created On
25 Sep 2022 20:29:40 UTC
Transaction ID
Cost
Safe for Work
Free
Yes
ReactJS Pitfalls #2 - using useState Instead of useRef, useCookie, useLocalForage
Suppose you want to persist data across sibling nodes. The next logical step is to use the parent to save the data. You may end up falling into a pit by managing the Child's state in the parent, which ends up causing performance issues. To ensure that the value held by the parent does not cause a re-render but still passes to the child on a remount, you can use useRef in the parent component and useState in the child component, OR you can avoid the parent altogether and use useCookie or useLocalForage in the child component to persist across entire app sessions rather than just sibling nodes.
...
https://www.youtube.com/watch?v=IpwdQiEAWJE
Author
Content Type
Unspecified
video/mp4
Language
English
Open in LBRY

More from the publisher

Controlling
VIDEO
MUSIC
Controlling
VIDEO
MAX P
Controlling
VIDEO
PSA:
Controlling
VIDEO
RUST
Controlling
VIDEO
TAURI
Controlling
VIDEO
TAURI
Controlling
VIDEO
RAZER
Controlling
VIDEO
TAURI
Controlling
VIDEO
PYTHO