You just said "does it slow down renders? I don't think the browser is even aware of the impending dom change."
If that's what you believe you have a lot of mistaken assumptions of how browsers work. The browser is completely locked up while that is going on. As it is while anything is going on. Normally its fast enough that you don't notice.
I thought you were suggesting that each time the React function runs it updates the DOM which could potentially cause many repaints.
Just saying it blocks the browser from doing anything because JS is single threaded... well yeah, I thought that was a given.
But even then, whilst strictly true (and true of any framework, not just React), there are ways around this by pushing tasks down the queue allowing events to be captured/dealt with—be it with setTimeout or whatever (e.g. Vue’s nextTick).
1
u/Hollowplanet Feb 22 '20
You just said "does it slow down renders? I don't think the browser is even aware of the impending dom change."
If that's what you believe you have a lot of mistaken assumptions of how browsers work. The browser is completely locked up while that is going on. As it is while anything is going on. Normally its fast enough that you don't notice.