Resetting State with key
Changing a key remounts a component and resets its state.
Example
function Page({ userId }) {
return <Profile key={userId} id={userId} />;
}Exercise
Reset trick.
<Profile ={userId} />
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.