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.
- 	
				
								Badlands Media
10 hours agoBaseless Conspiracies Ep. 157
17K11 - 	
				
							2:06:09
								Inverted World Live
6 hours agoMysterious Crash at Area 51 | Ep. 134
7.48K2 - 	
				
							2:48:59
								TimcastIRL
4 hours agoTrump Endorses Cuomo, Says NO COMMIE MAMDANI, Obama REFUSES To Endorse Mamdani | Timcast IRL
244K124 - 	
				
							LIVE
								Drew Hernandez
22 hours agoGOP CIVIL WAR: TUCKER CARLSON DERANGEMENT SYNDROME AT ALL TIME HIGH
1,154 watching - 	
				
							14:44
								Sponsored By Jesus Podcast
1 day agoYou Can't Serve God & MONEY | Is Money the Root of All Evil?
11.1K14 - 	
				
							2:47:28
								Barry Cunningham
8 hours agoYOU'VE BEEN MISINFORMED! GREED IS ACTUALLY GOOD! ESPECIALLY NOW! (AND MORE NEWS)
80.8K31 - 	
				
							LIVE
								SpartakusLIVE
8 hours agoSNIPING in Battlefield 6 - REDSEC || Monday MOTIVATION to CONQUER the Week
169 watching - 	
				
							49:25
								ThisIsDeLaCruz
4 hours ago $4.69 earnedBack Stage Pass with Avenged Sevenfold
40.3K7 - 	
				
							6:43:40
								GritsGG
9 hours agoWorld Record Win Streak Attempt! #1 Most Wins 3880+!
14.8K1 - 	
				
							3:12:05
								Tundra Tactical
6 hours ago $10.28 earnedProfessional Gun Nerd Plays Battlefield 6
51.6K5