MemotivaReact Hooks Basics

What is the difference between useRef and useState?

React Hooks Basics

Audio flashcard · 0:11

Nortren·

What is the difference between useRef and useState?

0:11

Updating a useState value causes the component to re-render. Updating a useRef current property does not trigger a re-render. Use state for values that affect the output, and refs for values that should persist without causing updates.