Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preact support #7721

Closed
augmen opened this issue Aug 10, 2017 · 23 comments
Closed

Preact support #7721

augmen opened this issue Aug 10, 2017 · 23 comments
Labels
external dependency Blocked by external dependency, we can’t do anything about it new feature New feature or request preact

Comments

@augmen
Copy link

augmen commented Aug 10, 2017

Can we use the material-ui with preach ?

@the-simian
Copy link

I'm sure the lead maintainers will weigh in on this, but to my understanding there are a few known issues here and there eg #7538

@oliviertassinari oliviertassinari added new feature New feature or request v1 labels Aug 10, 2017
@oliviertassinari
Copy link
Member

I haven't test. I would expect some issues with preact. Still, we would love to see the support of preact comes true. That's not something I will work on, but I hope someone will take the lead on this issue.

@oliviertassinari oliviertassinari changed the title material-ui with Preact Preact support Aug 10, 2017
@augmen
Copy link
Author

augmen commented Aug 10, 2017

ok so it works with react ? only ?

@oliviertassinari
Copy link
Member

Most of the components should be working but we potentially have edge cases where they don't. Hard to tell until someone giving us a better understanding of the situation.

@thangngoc89
Copy link

@oliviertassinari I'm about to start a new project and with preact-cli and Material UI. I'll send PR/issues when I found something doesn't work with Preact.

@oliviertassinari
Copy link
Member

@thangngoc89 Awesome, let us know how it goes 👍 .

@thangngoc89
Copy link

thangngoc89 commented Aug 17, 2017

If you guys only use public API of React, there shouldn't be any issue. But React v16 compat is not a thing yet.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 19, 2017

The Apache Software Fondation has raised some concerns around the licence of React.

The patent grant says that if you're going to use the software we've released under it, you lose the patent license from us if you sue us for patent infringement.

facebook/react#10191

I think that it's important to have an escape route like preact. This is the most interesting article I have found on the topic. While the patent clause on itself sounds like a good idea, the strong aspect of the patent retaliation clauses sounds like a general defensive clause for Facebook, unrelated to React.

@addyosmani
Copy link

Most of the components should be working but we potentially have edge cases where they don't. Hard to tell until someone giving us a better understanding of the situation.

Would someone trying to get the test suite passing using preact and preact-compat at least get you closer to feeling like some of the edge-cases are covered? I imagine the test suite isn't comprehensive enough to capture everything that's likely to break..but it's a start.

@hassanbazzi
Copy link

I've been using Material-UI with Preact-CLI for the past month. It's been powering our internal dashboard. The only real issue I've found is that modals don't work. It seems timing related, and @developit seemed to think the same. I'm going to work on a fix this weekend if noone gets to it.

I documented the issue well on my end, so I'll provide those as well maybe later today.

@rosskevin
Copy link
Member

@hassanbazzi that must be because of internal/Portal.js. If there is a better agnostic or pluggable way to Portal components, please feel free to PR that.

@hassanbazzi
Copy link

@rosskevin are you referring to something like this? https://github.com/developit/preact-portal

@rosskevin
Copy link
Member

Yes

@oliviertassinari
Copy link
Member

I have been giving a shot at this issue with #8119.

@dcworldwide
Copy link

React license has changed based on community feedback. https://ihatetomatoes.net/react-license-updated/.

Does this change this req or is preact support required for non-license reasons?

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 25, 2017

@dcworldwide We can get a 10% time to interaction improvement for the documentation. So yes. I think that it's still interesting.

@oliviertassinari
Copy link
Member

@dcworldwide Well, at least I want to compare preact with the react@next version. The React team as made an important effort making the lib faster and lighter, the diff could be less important.

@pelotom
Copy link
Member

pelotom commented Sep 25, 2017

It’s not about choosing one or the other, but allowing downstream users to make the choice for themselves, right?

@koutsenko
Copy link

koutsenko commented Dec 18, 2017

Modals still not work in preact, using preact-compat package (which provides same React API).
Can @developit comment that no one react ui lib can't be used with preact due to lack of portal support?

@oliviertassinari
Copy link
Member

A new alternative is available: nerv. I'm eager to see if we can support this library.

@kireerik
Copy link

kireerik commented Jan 12, 2018

Almost works! I will try again once createFactory API (NervJS/nerv#17) is supported as well.

@kontrollanten
Copy link

I've problem with MuiThemeProvider together with Webpack 4 and UglifyJSPlugin. MuiThemeProvider returns children as an array when UglifyJSPlugin option unused: true (which makes Preact return it as undefined). When I turn it off returns children as a VNode (and everything works as expected). I'm not that experienced with how React or preact is supposed to work here. Do you have a clue where to go further in this investigation?

I'm using material-ui 1.0.0-beta.35.

kontrollanten added a commit to hitta-skyddsrum/webclient-preact that referenced this issue Feb 28, 2018
When uglifying with `unused: true` MuiThemeProvider returns
its children as an array instead of an VNode, which makes the
whole element become `undefined`.

mui/material-ui#7721 (comment)
kontrollanten added a commit to hitta-skyddsrum/webclient-preact that referenced this issue Feb 28, 2018
When uglifying with `unused: true` MuiThemeProvider returns
its children as an array instead of an VNode, which makes the
whole element become `undefined`.

mui/material-ui#7721 (comment)
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 30, 2018

I fear that supporting Preact would require us to sacrifice some feature of React that are not yet supported by Preact. The situation is probably worse now that when this issue was opened. React 16 has introduced quite some new features (createPortal(), getDerivedStateFromProps(), <Fragment />, createContext(), etc.).

The market share hasn't evolved much in a year. Preact still accounts for around 2% of the React downloads. React 16.x payload has greatly improved. I'm closing for preactjs/preact-compat#476

@oliviertassinari oliviertassinari added external dependency Blocked by external dependency, we can’t do anything about it and removed help wanted labels Jun 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency Blocked by external dependency, we can’t do anything about it new feature New feature or request preact
Projects
None yet
Development

No branches or pull requests