Question 7 of 10Pro Only

What is layout thrashing, and how do you avoid it to optimise rendering performance?

Sample answer preview

Layout thrashing, also called forced synchronous layout, happens when JavaScript repeatedly forces the browser to recalculate layout within a single frame. To see why, you need the rendering pipeline: style, layout, paint, composite.

forced synchronous layoutreflowgetBoundingClientRectbatch reads and writesrequestAnimationFrametransform

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Frontend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime