Back to Browse

Avoid this React State Mistake | React Previous State Explained

40.4K views
Oct 8, 2021
13:22

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap In this tutorial, React Previous State is explained. I will also explain why using setState with count + 1 is NOT wrong... but updating previous state in React requires an understanding of how state and re-rendering work together. 🚩 Subscribe ➜ https://bit.ly/3nGHmNn πŸš€ React JS for Beginners full course - 9 hours: https://youtu.be/RVFAyFWO4go Avoid this React State Mistake | React Previous State Explained (00:00) Intro (00:05) count + 1 is NOT wrong (01:12) Know when to use the right tool (01:28) The Golden Rule (02:09) Previous State function example (03:05) Why prefer the prevState function (07:28) Previous state with arrays (10:03) Previous state with objects (12:06) Summary πŸ”— ES7 React JS Snippets Extension for VS Code: https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets πŸ”— React Dev Tools Extension for Chrome: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi πŸ“š References: ReactJS Official site: https://reactjs.org/ React Wikipedia: https://en.wikipedia.org/wiki/React_(JavaScript_library) React Jobs: https://www.ziprecruiter.com/candidate/search?search=react&location= βœ… Follow Me: Twitter: https://twitter.com/yesdavidgray LinkedIn: https://www.linkedin.com/in/davidagray/ Blog: https://yesdavidgray.com Reddit: https://www.reddit.com/user/DaveOnEleven Was this tutorial about understanding Previous State in React helpful? If so, please share. Let me know your thoughts in the comments. #react #previous #state

Download

1 formats

Video Formats

360pmp415.9 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Avoid this React State Mistake | React Previous State Explained | NatokHD