Material-ui: Preact support

Created on 10 Aug 2017  路  23Comments  路  Source: mui-org/material-ui

Can we use the material-ui with preach ?

enhancement external dependency preact

Most helpful comment

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.

All 23 comments

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 https://github.com/callemall/material-ui/issues/7538

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.

ok so it works with react ? only ?

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.

@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.

@thangngoc89 Awesome, let us know how it goes 馃憤 .

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

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.

https://github.com/facebook/react/issues/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.

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.

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.

@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.

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

Yes

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

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?

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

@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.

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

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?

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

Almost works! I will try again once createFactory API (https://github.com/NervJS/nerv/issues/17) is supported as well.

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.

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 https://github.com/developit/preact-compat/issues/476

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamzhouyi picture iamzhouyi  路  3Comments

ghost picture ghost  路  3Comments

ericraffin picture ericraffin  路  3Comments

FranBran picture FranBran  路  3Comments

ryanflorence picture ryanflorence  路  3Comments