2

Do I lose some technical benefit or is my code less reliable if I use material-css directly in my JSX rather than using a JSX specific library such as material-ui or react-toolbox? Or, conversely, do I gain performance, reliability or other measurable benefit by using a JSX library such as material-ui or react-toolbox rather than just putting materialize-css code in my JSX?

When writing React components, I find I can use materialize-css directly in my JSX:

<div className="row">
    <div className="blue lighten-5 col s12 m1 l1">1</div>
</div>
<a className="waves-effect waves-light btn">Stuff</a>

Or I can use JSX specific library such as material-ui:

import RaisedButton from 'material-ui/RaisedButton';
...
<RaisedButton label="Submit" type="submit" primary={true} style={style}/>

I'm not asking "Which is your favorite library?". Nor am I asking "What is the difference in output between RaisedButton and a button with this style: 'waves-effect waves-light btn'.

I'm asking: do I gain technical benefits or increased reliability if I use material-ui or some similar JSX specific library compared to just putting materialize-css code in my JSX? If there are benefits or risks involved then what are they? What should I be looking for in the way of pitfalls?

3
  • What did you decide in the end? and how did you see the benefits ? Commented Feb 21, 2018 at 16:09
  • @Mickey Puri: I ended up using Material-UI. The comments by both gravityplanx and Jeremy Bunn led me to this conclusion, and I don't regret it. I believe it makes my code easier to write and understand. Commented Feb 22, 2018 at 19:30
  • 1
    Thanks. I came to the same decision. I did however look quite hard at rmwc as it wraps the Google Web Components. But in the end decided to go with Material-UI due to its having a much larger takeup and userbase, hence seemed bit more mature Commented Feb 23, 2018 at 23:04

2 Answers 2

2

For buttons, the difference is inconsequential, so it's no surprise you're not seeing the best path.

Where Material-UI wins out is in it's functional components. The DatePicker, AutoComplete, and Tabs jump out as the most obvious in these regards. MUI is built on react, and these functional elements are setup to be customized by your own events and handlers in a way that raw css just can't do.

The MUI library is also just much larger than the materialize library.

Sign up to request clarification or add additional context in comments.

Comments

1

If you go the materialcss route, consider at least leveraging react-materialize.

https://react-materialize.github.io

There is a bit of work to do things the material way beyond the stylesheets. This requires JS, no need to reinvent the wheel. Plus you get all the advantages of leveraging a popular library. Testing, bug fixes, new functionality... etc..

The best part is, you can reinvent the wheel and make your own materialize based components if you want to and still have the same look and feel as the react-materialize components.

I however, am using Material-UI. It is a great framework for very rapidly developing modern looking apps.

Good luck!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.