6

Cracking the code: Material UI

 2 years ago
source link: https://dev.to/malissab/cracking-the-code-material-ui-4m16
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Here I am, back again to lay out the simplicities of programming. If you can find yourself to combine simple and programming in the same sentence... My first experience with Material UI, wasn't the best nor the easiest. It felt as if I was learning another language, but again like my last post...WHY? would we want to learn and implement Material UI into our projects?

THE PRELUDE!

I prefer to express concepts in a simplistic form. More often than not, learning and applying new languages can be difficult with some of the documentation we find online. I'd like to change that; With understanding the purpose and the problem a language or framework library is solving. I mean I don't mind almost going bananas, to simplify learning for new web devs on their journey. So...

WHAT IS MATERIAL UI?

Material UI is a component library made for react to streamline a faster, easier web development and user experience. Basically, Material UI allows us to style our react applications with prebuilt buttons, navigation bars, grid systems, etc. Everything from their library is styled following their very own specifications. It even integrates best coding practices, so that users and developers can easily understand and navigate your project. If you're familiar with Bootstrap, it's quite similar, but designed by Google and quite fancier if you ask me! No shade to Bootstrap though.

IMPLEMENTING MATERIAL UI.

FIRST THINGS FIRST...

To get started, and view changes to the styling of our webpage, we have to install a few things.

In order to use Material UI within our code editor, we must install all the dependencies necessary to implement styling. Otherwise, it wouldn't alter the design of our webpage.

We're now able to style our components, and import the component from Material UI.

In the above example, we declare a variable and set it equal to makeStyles. We also have to declare another variable inside our function to call makeStyles. In React, always use camel casing to apply styling, such as 'paddingLeft'.

Now we're set to apply our newly created styling components as a className or call the component in our return.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK