d3-component
d3-component copied to clipboard
Create React Interop Examples
(Excerpted from a discussion on the D3 Slack)
The thought "d3-component as a replacement for React's Component, as it basically replicates its functionality" is correct. But I also recognize that they need to play well together. It is possible to create a general-purpose shim between them, to create a React component "wrapper" or "wrapper factory" around any component authored using d3-component. I've been meaning to make this, or at least a PoC for it, but have not yet. It would translate into simply passing the props
from the React component render function into the d3-component instance. I'd welcome a PoC for this.
The first step would be to create a working example where a React component wraps around a specific d3-component. Maybe the Airport Clocks would be a good example?
Would be cool to have a "React Analog Clock" component up on NPM!
You might want to look at this: https://github.com/skellyb/react-d3-wrap. It seems like he has already implemented a D3 component wrapper - might be able adapt it.