C Sharper
C Sharper

Reputation: 8626

React - Material UI | Module not found: Can't resolve 'material-ui/Button'

I am using material UI button on my react application page.

import Button from 'material-ui/Button'
<Button color="primary" variant="raised">
          Group
</Button>

I have installed below package -

npm install material-ui
npm install @material-ui/core
npm install --save material-ui@next

I referred all of this from existing question.

But it proved to be of no use.

I am getting - Module not found: Can't resolve 'material-ui/Button'

EDIT 1 :

After adding -

import Button from '@material-ui/Button'

I am getting -

 Module not found: Can't resolve '@material-ui/Button'

Upvotes: 1

Views: 2181

Answers (2)

Merlin
Merlin

Reputation: 31

You are importing from the incorrect path it should be import Button from '@material-ui/core/Button'; not import Button from '@material-ui/Button';

Upvotes: 1

Robert Tirta
Robert Tirta

Reputation: 2911

As shown in the docs

You have to import it like this:

import Button from '@material-ui/core/Button';

// OR

import { Button } from '@material-ui/core'

Upvotes: 3

Related Questions