Answer the question
In order to leave comments, you need to log in
What's the easiest way to get the width of an element in React without jQuery?
There was a need to make the D3 library graphics adaptive, but the width={920} attribute does not work with percentages. Hence the question, how to get the width of a div element in react?
Answer the question
In order to leave comments, you need to log in
document.getElementById("mydiv").offsetWidth;
React actually has nothing to do with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question