0

I want to import material ui into my react code although i encoutered an error saying

Module not found: Can't resolve '@material-ui/icons/Search' in 'C:\Users\Dominik\code\facebook\src'

Shall I put a path to material ui or in package.json somewhere in VSCode ? There is version of material-ui in package.json so I dont know why i encouter such error.

2 Answers2

0

First make sure you install the package npm install @material-ui/icons. This is how you import your Material UI Icon component to react import SearchIcon from '@material-ui/icons/Search'; and you render it like <SearchIcon/>

Aravind Reddy
  • 353
  • 4
  • 18
0

I switched to linux and it finds the module but there's an error: https://snipboard.io/Pz1YEH.jpg

My code

`import logo from './logo.svg';

import './App.css';
import Button from '@material-ui/core/Button';
import AccessAlarmIcon from '@material-ui/icons/AccessAlarm';

function App() {
  return (
    <div className="App">
    
    <AccessAlarmIcon></AccessAlarmIcon>  <h1>Hello</h1>
    </div>
  );
}

export default App;

`