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.
-
27:09
Liberty Hangout
9 days agoFooling Libs to AGREE Biden's Cages Were Worse
133K27 -
1:42:04
RoxomTV
1 day agoBitcoin Airbnb, BlackRock Stacks, Trump Smashes Fed | Blockchain Report
6.04K1 -
1:27:18
Mike Rowe
2 days agoTheo Von Is Another Troubled White Boy | #449 | The Way I Heard It
93K27 -
3:50:41
FreshandFit
11 hours agoFresh&Fit Taking These Girls To Therapy
166K54 -
2:13:26
Badlands Media
13 hours agoDevolution Power Hour Ep. 390 - Political Warfare, Jimmy Kimmel & ANTIFA
94.7K31 -
2:43:56
TimcastIRL
8 hours agoJimmy Kimmel FIRED, ABC Pulls Show Over Charlie Kirk Assassination Comments | Timcast IRL
380K211 -
1:58:02
Barry Cunningham
9 hours agoJIMMY KIMMEL CANCELLED | OBAMA IS WHINING! | JD VANCE ON JESSE WATTERS!
110K131 -
2:34:46
TheSaltyCracker
8 hours agoWe Got Him Fired ReeEEStream 9-17-25
157K375 -
43:44
Man in America
10 hours agoAmericans Are About to Lose Everything—And They Don’t Even Know It
61.2K31 -
1:41:11
Adam Does Movies
2 days ago $3.58 earnedTalking Movies + Ask Me Anything - LIVE
46K2