declare a variable in a functional component in reactjs

Use the useRef hook. The value stored by the reference will not be reinitialized during a re-render. Changing the value stored by the reference will not trigger a re-render, as it is not a state change.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top