+ 1
How do I stop rendering of any component? or How can I fix the component rendering will happens only 3 times?
How do I stop rendering of any component? or How can I fix the component rendering will happens only 3 times?
3 Answers
+ 2
Maybe put the expression that is causing rendering of component inside a if statement with a variable count keeping track of how many time that particular component was rendered and if count is more than 3 the if statement will become false and component won't render more !,
+ 2
Priti Mondal
https://code.sololearn.com/W4MNpOfoMKG4/?ref=app
Here main component App is rendered 3 times indiated by the current state value changing inside button whenever button is clicked and thereafter further clicks result in no rendering
0
Can you please give code example? That will be really helpful to understand