79121530

Date: 2024-10-24 10:51:09
Score: 1.5
Natty:
Report link

You are right. useState() and useRef() might seem like a react-specific solution. But, if you see in vanilla js, you would have needed to write custom logic and update it. React, however, automatically re renders it and tracks those changes.

Without something like useState(), you would lose the previous state on every re-render because React components are re-executed each time they update.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Divyaa01