developerasun / myCodeBox-web

Open source code box for web developers.
Apache License 2.0
5 stars 0 forks source link

React/Hooks : useRef #234

Open developerasun opened 2 years ago

developerasun commented 2 years ago

research : understanding useRef hook in React

read this

useRef(initialValue) is a built-in React hook that accepts one argument as the initial value and returns a reference (aka ref). A reference is an object having a special property current.

There are 2 rules to remember about references: The value of the reference is persisted (stays the same) between component re-renderings; Updating a reference doesn't trigger a component re-rendering.

reference