mthanh2209 / react-training

https://react-training-eight.vercel.app
0 stars 0 forks source link

Implement preserving and resetting state #152 #173

Closed mthanh2209 closed 8 months ago

mthanh2209 commented 8 months ago
  1. When React chooses to preserve or reset the state:
    • unmount and mount: When a component unmounts (removed from the DOM) and subsequently mounts (added to the DOM) again, React by default resets the state of that component.
  2. How to force React to reset the component’s state:
    • Using the key prop: Changing the value of the key prop on a component forces React to consider it as a new instance, thus resetting its state.
vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-training ❌ Failed (Inspect) Jan 9, 2024 10:20am
storybook ❌ Failed (Inspect) Jan 9, 2024 10:20am