Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

333
Visualizações
How to solve Invalid Hook Call error when using Material UI?

I'm new at coding and I'm having the following error when adding a MaterialUI Icon

import PersonIcon from '@mui/icons-material/Person';


function Header() {
    return (

<div>
<PersonIcon />
<h2>Header file</h2>



</div>

    );
}

export default Header;


When adding I get the following error:

Console Error when adding

Please notice that I have installed MaterialUI Core and also MaterialUI Icons When not adding everything works fine

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try this

npm uninstall @material-ui/core @material-ui/icons

Then

npm i @material-ui/core @material-ui/icons

Restart the React server

npm start
// OR
yarn start

Let me know if it works, Good Luck

about 4 years ago · Juan Pablo Isaza Relatório

0

You need to wrap your app in ThemeProvider:

index.js:

import * as React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import App from './App';

const theme = createTheme({
  palette: {
    primary: {
      main: '#556cd6',
    },
    secondary: {
      main: '#19857b',
    },
  },
});


ReactDOM.render(
  <ThemeProvider theme={theme}>
    <App />
  </ThemeProvider>,
  document.querySelector('#root'),
);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda