Google News
logo
ReactJS - Quiz(MCQ)
What happens when you call setState() inside render() method?
A)
Repetitive output appears on the screen
B)
Nothing happens. Life goes on!
C)
Duplicate key error
D)
Stack overflow error

Correct Answer :   Stack overflow error


Explanation : Call to setState() invokes render(). Calling it inside render is suicidal. It gets into an infinite loop