Premium Only Content

Load React Component Data using useState and useEffect
The lesson goes over setting up a callback to React.useEffect to set the data for the messages in the chat room-like frontend application.
To make React be aware of any changes, the React.useState hook is used to keep track of the list of posted messages.
If you use a plain array of strings and set it to some initial values in the useEffect callback, React is not made aware of that change, so you don't see any update in the Document Object Model (DOM).
The way you react to changes in the application state, such as new messages populating an array, is by letting React know about that data. With the hook useState, you are given a function to mutate the state.
Calling the function to mutate the state that stores the message, React will render the component anew, reflecting the change in the elements of the array.
-
1:54:27
Glenn Greenwald
5 hours agoAs Tariffs Dominate News, Trump and Netanyahu Make Increasingly Militaristic Threats; Plus: Mixed Supreme Court Ruling on Deportation Powers | SYSTEM UPDATE #435
107K76 -
LIVE
Man in America
5 hours agoMAHA Feels Betrayed by RFK Jr.—What's REALLY Happening? w/ Sayer Ji
1,285 watching -
LIVE
Savanah Hernandez
3 hours agoToxic Empathy Is Ruining America
2,208 watching -
1:39
Stephen Gardner
6 hours ago🚨BREAKING: Karoline Leavitt MAKES STUNNING announcement about Trump's Assassin!
16.1K8 -
1:32:10
Joker Effect
1 hour agoRumble is about to get a new genre!! Are you ready to take it on? Time to fight fire with fire!
14.2K -
LIVE
SilverFox
1 hour ago🔴LIVE - ELDEN RING - ZERO DEATH CHALLENGE - ATTEMPT 5
146 watching -
17:17
SantaSurfing
4 hours ago4/8/2025 - Modern Day Wealth Managers! The Rewards of planning and dreaming big!
8.83K16 -
26:40
Producer Michael
8 hours agoI WAS ROBBED IN MY NEW HOUSE!
9.59K1 -
13:00
SKAP ATTACK
4 hours ago $0.26 earnedMichael Malone FIRED by Nuggets
4.7K1 -
1:11:45
NucleoNick
1 day ago🟢LIVE NOW! The Legend of Zelda: Skyward Sword - Part 8🟢
2.62K