(no title)
zappo2938 | 4 years ago
I wonder if is better to have the d3 function inside of useCallback() and pass data as a parameter where the function isn't re evaluated rather than in useEffect where the function is run from the top again?
zappo2938 | 4 years ago
I wonder if is better to have the d3 function inside of useCallback() and pass data as a parameter where the function isn't re evaluated rather than in useEffect where the function is run from the top again?
uhoh-itsmaciek|4 years ago
This is really the central point:
>The crux of the issue is that they both want to handle the DOM.
If you want to use D3 and React together, you need to figure out how to handle this, and there are several reasonable ways to do that. Letting React handle rendering is a natural approach, and works especially well if you are embedding your SVG components in an existing React application.
But the "hand a ref off to D3 and keep React out of that element" approach can also work, especially if you are more familiar with D3 DOM manipulation already.
[1]: https://pganalyze.com/blog/building-svg-components-in-react
zappo2938|4 years ago
unknown|4 years ago
[deleted]
knuthsat|4 years ago