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.
-
LIVE
Dear America
1 hour agoCharlie’s Assassin In Court!! DEATH PENALTY!! + Evil Media Defends The Killer?!
18,268 watching -
LIVE
Badlands Media
6 hours agoBadlands Daily: September 17, 2025
1,141 watching -
LIVE
Wendy Bell Radio
5 hours agoDerangement Is A Bad Look
7,775 watching -
LIVE
Matt Kohrs
10 hours agoStock Market Open: HAPPY FOMC DAY!!! || Live Trading Futures & Options
882 watching -
LIVE
Crypto Power Hour
1 hour ago $0.09 earnedWEB 3, Reclaiming The Internet
99 watching -
LIVE
Total Horse Channel
1 hour ago2025 WDAA Western Dressage World Championship Show | Day Two | Arena Four
186 watching -
LIVE
LFA TV
4 hours agoLFA TV ALL DAY STREAM - WEDNESDAY 9/17/25
4,629 watching -
1:15:33
JULIE GREEN MINISTRIES
3 hours agoLIVE WITH JULIE
78.8K161 -
3:59:03
The Bubba Army
23 hours agoState of Utah Wants Tyler Robinson DEAD! - Bubba the Love Sponge® Show | 9/17/25
62.3K6 -
LIVE
JuicyJohns
1 hour ago $0.19 earned🟢#1 REBIRTH PLAYER 10.2+ KD🟢
78 watching