'Mui Button not working: Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component
->> SOLVED: npm install @mui/material @emotion/react @emotion/styled
I just copied this from the mui site and installed it via npm install @mui/material.
This is my index.js file:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Button from '@mui/material/Button';
ReactDOM.render(
<React.StrictMode>
<Button variant="contained">Hello World</Button>;
</React.StrictMode>,
document.getElementById('root')
);
I get this error: Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
