InterviewBuddy
All interview questions

Why should you avoid mutating state directly?

Beginner

Answer

React uses state values as snapshots. Create a new object or array when updating so the next render receives the intended value and previous snapshots remain intact.