+ 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?

19th Aug 2020, 11:00 AM
Priti Mondal
Priti Mondal - avatar
3 odpowiedzi
+ 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 !,
19th Aug 2020, 11:10 AM
Abhay
Abhay - avatar
+ 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
19th Aug 2020, 12:14 PM
Abhay
Abhay - avatar
0
Can you please give code example? That will be really helpful to understand
19th Aug 2020, 11:12 AM
Priti Mondal
Priti Mondal - avatar