Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
Changing to '@mui/material' makes the components not rendered

I have a JS file (react) that looks like this:

import { Grid, TextField, makeStyles } from '@material-ui/core'
import React from 'react'
import {useState}  from 'react'


//remove this function and refresh. see magic.
const useStyle = makeStyles(theme => ({
    root:{
        '& .MuiFormControl-root':{
        width : '80%',
        margin : theme.spacing(.75)
        }
    }
}))

const initialFormValues = {
    id:0,
    name:'',
    username:'',
    email:''
}

export default function EntryForm() {
    const [values, setvalues] = useState(initialFormValues)

    return (
        <form className={useStyle().root}>
            <Grid container>
                <Grid item>
                    <TextField
                    size='small'
                    variant='outlined'
                    label='name'
                    value={values.name} />
                    <TextField
                    size='small'
                    variant='outlined'
                    label='username'
                    value={values.username} />
                    <TextField
                    size='small'
                    variant='outlined'
                    label='email'
                    value={values.email} />
                </Grid>
                <Grid item>
                </Grid>
            </Grid>
        </form>
    )
}

This works fine, and invoked, the fields get rendered along with it's parent components.

However, changing first line to:

import { Grid, TextField, makeStyles } from '@mui/material'

and refreshing the browser makes the whole page empty. Apparently, this happens specifically with makeStyles from '@mui/material' usage. Using Grid and Textfield from '@mui/material' only doesn't cause that.

What is happening here?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As per docs you should import makeStyles from @mui/styles.

Please try updating the import statement as:

import { makeStyles } from "@mui/styles";
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda