Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Improve docs: ES6 usage example #64

Closed
GeorgeStrakhov opened this issue Aug 9, 2016 · 2 comments
Closed

Improve docs: ES6 usage example #64

GeorgeStrakhov opened this issue Aug 9, 2016 · 2 comments

Comments

@GeorgeStrakhov
Copy link
Contributor

First, thanks for great work!

Second, I followed the example and struggled for a few minutes to get this to work in ES6 before I realising that I needed to do import * as d3 from 'd3' instead of `import d3 from 'd3', as per this thread.

@Olical, do you have any plans to update the docs to include some ES6 usage example, or should I do a simple PR with an ES6 example?

@Olical
Copy link
Owner

Olical commented Aug 9, 2016

Ah, that's a sneaky one that caught me out too. Not the first time I've been angry at the JavaScript module system (or JavaScript in general). It'd definitely be worth documenting it, even though D3 isn't a hard requirement for this project it's something that will catch people out again and again.

Maybe add a section to the readme just after installation that shows ES5 and ES6 import styles with the D3 caveat. Maybe even a script tag for the CDN version too. One quirk about the CDN file (which I don't use, some people requested it, I think you should depend on it and build it into your main script) is the name it's exported with. It's accessed by window['react-faux-dom'] not window.ReactFauxDOM as you'd expect.

Could be worth mentioning that too. I can do it but if you had some time and wanted to write up a little readme section I'd be happy to merge it 😄

@GeorgeStrakhov
Copy link
Contributor Author

I am new to all this, but here is an attempt: #65 .
I only covered basic D3+ES6 usage, and not other issues you mentioned.

@Olical Olical closed this as completed Sep 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants