-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Proposal] Stateless Material-UI #2784
Comments
Not that formsy-material-ui is particularly complex as most of the hard work is done by formsy-react (and there is plenty of room for improvement - HOC not mixin, ES6 classes, ES6 modules), but from my perspective, if the material-ui form component API was standardised, it would have made implementation much simpler still. Across the form components, there are at least three variations of the So, I am supportive of the idea, but I'm conscious that it would be a breaking change. If it's going to happen, then sooner is better than later I think. |
I love the sound of that. The sooner it happens I'll have less code to worry about. But if we ease into it everyone will have time to slowly adept and make smaller changes per release. I you ask me I'm all in for sooner. But i'm not the only user of this library ( ^_^ ) |
Yeah, let's wait a bit 😁.
|
I agree with you, the simpler our component are, the best it's. Going in this direction sounds like a good idea 👍. |
I'm very much in agreement with this direction (probably not much of a surprise 😄). I think it makes a lot of sense to externalize the state and allow the developer to decide where they want state stored (ie. a basic stateful wrapper component or something like redux). I'd very much like to write some tooling to better integrate material-ui with redux in some of my personal projects and this would certainly help. 👍 |
I have just discovered https://github.com/acdlite/recompose. That's preaty interesting!
That could make our life easier 😍. What about migrating with this and radium 😁? |
@oliviertassinari Yeah that's a cool toolset. I ran into it earlier and thought it might be useful too. Also that post on performance is very interesting! |
I really like how Recompose addresses such issues 👍 👍 But... We still have 2 concerns with Recompose:
Yeah I think code quality matters too 👍 👍 I want to address the theme for now, We will clean up a whole lot of components with this. I don't think I can continue with my previous huge PR with that huge es-lint rule though 😁. @oliviertassinari So have we decided on Radium? Do you think how they traverse the tree can impact performance that badly? 😁 P.S. We can still consider inheritance. I'll continue my work so we can see how it would turn out 😁 |
That's not true, for performance reason, they are using a class under the hood for soom recompose function. That's not yet documented.
Yes, that would be awesome.
I guess we can use this.refs.input.refs.input.focus(); instead of this.refs.input.focus();
Well, if we split up our component and implement |
Alright, I'll study Recompose a bit more. And I agree with Radium too. It's got good stuff 😁 |
By the way, radium and react-look are using the HOC like approach. So, even if we use the inheritance, we will have to deal with those issues. |
@oliviertassinari Yeah I guess -_- This is getting hard 😫 I have to give it a lot of thought. @newoga You think about this too 😁 |
@alitaheri @oliviertassinari Will do. I starting writing a long response earlier before deciding it was too long and most likely wasn't worth the read 😆. I'm certainly continuing to give this thought. Like we said before, I believe if we continue to refactor/clean up code in the more obvious areas, things will become clearer and we'll have a better "playground" to experiment with these different approaches and libraries. I have some more specific thoughts maybe in which the order we can start doing some of the activities on the roadmap. I'll jot some ideas down later and share for feedback. |
@newoga Sounds good to me, I agree that we should focus on the quality of the code and get rid of all the |
Related: #2957 |
With the move to a (more) stateless implementation the |
@Kosta-Github That's an interesting point. Moving to functional components that return JSX technically opens up the possibility for material-ui to be used with frameworks outside of React that use JSX, like preact. 👍 |
I really like the idea of separating between stateless & stateful component! ❤️
|
@nikgraf Thanks for taking part in the discussion 👍 The more brain power we have the better the decision we make 😁
That wasn't the original reason. it's for integration with the Wrapper. we still pass the event. it won't break their previous knowledge. the thing about passing an object is that it's very uncommon and a bit hard to document and keep track of, but it's something workth discussing 👍 Thanks fo your awesome feedback 😄 |
Reading the roadmap, being farily new to React and all, I found this issue and wondered why |
@yanickrochon This thread is almost 1-year-old. Things have changed in the ecosystem since then. |
@alitaheri I 100% agree, we have removed as much as state as possible in the components migrated to the v1-alpha branch. I think that we can close it, we have learned from our mistakes :). |
After seeing a huge number of regressions and bugs introduced only because there are 2 sources of truth for most components (state and prop) I have come to the conclusion that state is bad for business.
The Problem
Take a look at all the bugs. I can argue that more than half of them is caused by the complexity of internal logic of the components. And the biggest reason is keeping the state up-to-date with props.
The Solution
No more support for uncontrolled behavior!
How about forms?
you can then call imperative methods on this.refs.input. or handle the on change. This will require standard callback signatures which is a must even without this.
2. Third party projects like Fromsy can solve this issue
3. HOC on user-side. I don't think it is that hard to implement anyway.
Roamap
value
+onChange(event, value)
[debatable] and no more!@oliviertassinari @mbrookes @newoga I would like to hear your insight on this. Thanks 👍 👍
The text was updated successfully, but these errors were encountered: