Material-UI Flashcards

1
Q

What is material UI?

A

It is just a React UI library, which provides pre-baked, react components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How MUI provides different variants of a single component?

A

By providing different “props”/properties, we can use different variants of same component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How a new person can read about different variants of any component?

A

It provides we formed documents, which provides information about each component APIs and different variants.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to install MUI in react?

A

It is done by installing three important libraries:

  1. mui/material
  2. emotion/react
  3. emotion/styled
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is emotion library?

A

Emotion is an styling engine, which helps in writing CSS with javascript.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which CSS library is used by MUI?

A

emotion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to import any component from MUI?

A

Using following import statement:

import Button from ‘@mui/material/Button’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can we change the variant of the button?

A

It can be changed by using property as “variant” and the different value of the property e.g.
My Button

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can we disable a button by using property?

A

Yes, we can use “disabled” property to make any button as disabled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to add a on-click event on a button?

A

This is done by using “onClick={}” property to the button. Any function passed to this function, will get executed once a user click over the button.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Does Icons included in MUI package?

A

No, we need to install it separately.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can we install the icons requirements?

A

Using MUI’s “icons-material” package.

e.g. npm install @mui/icons-material

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose of “export default”?

A

This is required when we want to export only a single value from a file which can be:

  1. Class
  2. Function
  3. Object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a component in React?

A

It is nothing but a “function” which is exporting a react element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to consume a “component’ inside the “app.js’ file?

A

Import the react component and then call same just like a html tag.
e.g.
import NavBar from ‘./components/nav-bar/navBar.js’

<div>

</div>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Explain the step by step process of adding a component from MUI to our app.js?

A
  1. Go to MUI website
  2. Go to Components section
  3. Search for required component
  4. Copy the component code only (with tags)
  5. Copy all the import files
  6. Save same inside our custom component.
    Reload and enjoy !!!
17
Q

What’s the purpose of “consts” folder and how should we use inside our components?

A

The purpose of “consts” folder is to create different constants, which can be imported inside our components.
e.g. all navigation items, must be added inside the const folder, so that, we can change same, if there is any requirement.

18
Q

How to find out the “material-icons”?

A

Just go to the MUI website and search for Material ICONS.

19
Q

How can we add icons inside the drawer?

A

Simply copy the import statement and call the component inside the other component using tags:
e.g.