Last active
January 2, 2020 15:58
-
-
Save nautilytics/25ec5beab44ecfd0f192ab6e78878a12 to your computer and use it in GitHub Desktop.
Using d3-transition with React
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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