Welcome to Learning at Lambert Labs session #13. This week, Guy King, explains how React updates State asynchronously in a component.
In Today's Learning Session:
What is State in a React component?
useState hook in React 16+
Callbacks for setting State
Why use callbacks?
Normal case vs. unexpected case with setTimeout
When should you bother with callbacks for asynchronous updates to State
Q&A from our developers!
0:04 Introduction
0:26 What is State in React?
3:21 How to set State in React 16+?
4:52 Callbacks
5:57 Why use a Callback function in setState
7:05 The expected case
9:28 The unexpected case with setTimeout
12:06 What happened?
12:52 Use callbacks to update State
14:55 Should you care?
17:04 Questions
🔊 Subscribe to our channel for weekly learning sessions! / @lambertlabs
🔗 Lambert Labs Links 🔗 :
🌎 Website: https://lambertlabs.com/
📱 Twitter: / lambertlabs
📝 LinkedIn: / lambertlabs
📂 GitHub: https://github.com/lambertlabs
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
⭐ Tags ⭐
React
JavaScript
Callbacks
Asynchronous