React DOM

DOM measurement with refs

Capture geometry in CSS pixels using a committed node; a snapshot is not continuous observation.

Formal Syntax & Structure

react syntaxreact
node.getBoundingClientRect()

Working Example

Example Snippetreact
Math.round(node.getBoundingClientRect().width);
React Reference