Ivana
Ivana

Reputation: 842

Module not found: Can't resolve '@material-ui/core/RaisedButton' in React

I am getting the error

Module not found: Can't resolve '@material-ui/core/RaisedButton' in 'C:\wamp64\www\multi-step-form\src\components'

I have installed @material-ui/core

My imports in this file are:

import React, { Component } from 'react';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import TextField from '@material-ui/core/TextField';
import RaisedButton from '@material-ui/core/RaisedButton';

and the dependencies in package.json looks like:

 "dependencies": {
    "@material-ui/core": "^3.9.2",
    "normalize.css": "^8.0.0",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-scripts": "1.1.5"
  },

Can somebody check?

Upvotes: 2

Views: 7683

Answers (1)

Alexander Staroselsky
Alexander Staroselsky

Reputation: 38777

There is no RaisedButton button component in Material-UI. Instead just import Button and use the prop variant of value contained to have it raised. Don't use a variant of value raised as it's deprecated, use contained:

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

// ...

<Button variant="contained">
  Default
</Button>

Here is an example in action.

Hopefully that helps!

Upvotes: 3

Related Questions