Because of the following reasons, it is never a good idea to change the state directly: If you alter it directly, executing setState() subsequently may just overwrite your changes. This is not changed when you directly update the state.
Event handlers, server responses, and prop modifications can all cause state to be modified. The setState() method is used to accomplish this. The setState() method enqueues all component state updates and tells React to re-render the component and its descendants with the modified state.
We can change the state without directly mutating it using setState(). As a result of the state change, the component will need to be re-rendered. However, we must exercise utmost caution when using it. When you don't use setState() correctly, you'll not only miss your aims, but you'll also have performance concerns.
Learner's Ratings
4.6
Overall Rating
79%
12%
6%
1%
2%
Reviews
M
Mohanlal Khhurana
5
Very helpful course in learning ReactJS
A
Abdul Sattar
5
Please update this course some topics are deprecated.
M
Muhammad Usman
5
Amazing course
Y
Yash Patel
5
Superb Course Thanks for sharing
K
Karan
5
Learnvern All Courses are Great Thanks To Provide Best Content.
Me Aapka Life Time Tak Abhari Rahunga
Thanks
A
Ankush Mittal
4
resources me jake download ki file but file open krne pr usme kuch hi aahra
S
satyam pandey
4
resourse link is not working
N
Niyyer Abbas
5
good
T
Tanay Lohani
5
very good course. Content Delivery of Trainer is very very awesome. I suggest everyone who want to learn react I prefer learn vern
M
Manish Kumar
5
Thanks LearnVern, If I get job than I will donate my 1st salary to LearnVern
Share a personalized message with your friends.