benwiley4000 / react-dot-fragment

🦄 Use React 16's <React.Fragment> in React 15

Home Page:https://benwiley4000.github.io/react-dot-fragment/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this work with other React-like libs like Preact, Inferno, etc?

AndyOGo opened this issue · comments

I'm curious if that is compatible with Preact and Inferno and so on.

In theory it should work if React is aliased 🤔

@AndyOGo I don't know, would you care to test? :)

@AndyOGo Intuitively I think the answer is yes but I haven't checked yet. If you'd like to test on your own, we can add the answer to the docs. Otherwise I may be able to get around to checking sooner or later, but I can't give a timeline. My development's been on hiatus but I'll likely resume in the next week or so.

I did a quick review of what we depend on from React:

  1. require('react') returns the library as React
  2. React has a createElement function
  3. Element excepts a ref callback prop which receives the DOM element for the div
  4. (Optional but desired) Newer versions have a React.Fragment element which is used in place of the polyfill

The "compat" versions of preact and inferno seem to support 1-3. They don't appear to support React Fragments at all yet, but it looks like you should be able to use this polyfill just fine! Let me know if you experience any issues there.

@AndyOGo

@benwiley4000
Thank for your quick answer.
And sorry for delay, currently problems drop from every side...

Interesting, in that case I agree it should work.

Going to close this for now. Can re-open if we see this doesn't work.