learn the difference between React useRef and useState
This kept me wondering for quite a while. Now I know :D
- useState will trigger a rerender, while useRef will not
- The variable in useRef can be accessed in arrow functions!!!
- useState will trigger a rerender, while useRef will not
- The variable in useRef can be accessed in arrow functions!!!