Skip to content

Instantly share code, notes, and snippets.

@nautilytics
Last active January 2, 2020 15:58
Show Gist options
  • Save nautilytics/25ec5beab44ecfd0f192ab6e78878a12 to your computer and use it in GitHub Desktop.
Save nautilytics/25ec5beab44ecfd0f192ab6e78878a12 to your computer and use it in GitHub Desktop.
Using d3-transition with React
import {select as d3_select} from 'd3-selection';
...
const markerRef = useRef();
useEffect(() => {
d3_select(markerRef.current)
.transition()
.duration(1000)
.attr('cx', item.x)
.attr('cy', item.y);
}, [item]);
return (
<circle ref={markerRef} r={item.r} className='marker'/>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment