Closed canadaduane closed 8 years ago
I wrote the API like this to follow the existing document.createElement API. The goal was to follow the DOM API exactly, but just enough for it to work with D3 (for starters).
This was partially so you could avoid using JSX for something that D3 is quite good at, turning data into some form of complex document. (data driven documents). Turning JSX -> DOM -> JSX (essentially) is a strange round trip in my opinion.
This isn't supposed to be a rendering target for JSX, it's an alternative to JSX. JSX just compiles to function calls which create a React DOM. ReactFauxDOM is mutated then compiled to React DOM.
They're not really compatible with each other, they're options depending on how you are building your React DOM.
Got it. I misunderstood. Thank you!
No problem! Closing this now, I hope that helped :)
I'm a bit surprised that the faux DOM createElement method doesn't support the same method signature as regular React.createElement:
ReactFauxDOM:
As a result, it appears it isn't possible to actually swap ReactFauxDOM in for React, and use JSX:
(The
className
andHello
text are ignored by ReactFauxDOM).Is there a reason for this? Why not use the same method signature, and get JSX support for free?