yang-wei / rd3

react + d3
https://yang-wei.github.io/rd3/
MIT License
319 stars 83 forks source link

window.React #89

Closed aferrandi closed 8 years ago

aferrandi commented 8 years ago

I'm upgrading a project to version 15.1 of react and therefore I need to use the rd3 ibrary instead of esbullington/react-d3. The project uses requirejs to manage the dependencies and the problem I have is that react-d3.js uses React, ReactDOM and d3 as window.React, window.ReactDOM and window.d3 instead of of calling the require function. I understand this is a general way to use React, but in my case all the window.* variables are undefined, and therefore rd3 does not work. Is there a way to let it work, possibly without changing the content of react-d3.js?

yang-wei commented 8 years ago

We are using peer dependencies for those library so the thing you need to do is include those script before rd3 load.

https://github.com/yang-wei/rd3/blob/master/package.json#L60

You can see how the example in fiddle works.

image

https://jsfiddle.net/YangWei/8t16sp9g/1/