curran / d3-component

A lightweight component abstraction for D3.js.
BSD 3-Clause "New" or "Revised" License
108 stars 10 forks source link

Create React Interop Examples #77

Open curran opened 7 years ago

curran commented 7 years ago

(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.

curran commented 7 years ago

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!

warrenronsiek commented 7 years ago

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.