3 ms·
It not so much rewriting parts of D3 in React, as it is rewriting things you could use D3 for to make them use React. Both React and D3 can render to the DOM (
by Vinnl 6y ago
It not so much rewriting parts of D3 in React, as it is rewriting things you could use D3 for to make them use React.
Both React and D3 can render to the DOM (D3 additionally can do a whole lot else to ease working with data). Trying to get both to control what the DOM looks like is a pain.
So your options are either to not use React (this is fine), or to let React handle the DOM and only use the data manipulation parts of D3 (this is useful when integrating with a larger React application, i.e. if you're already using it to manage your DOM).
The useRef approach is essentially the worst of both worlds.