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

102
Vistas
A component is changing the uncontrolled value state of Select to be controlled error in ReactJS datagrid singleSelect

I hope someone will be able to help me with this problem.

I have a react datagrid table that has, as one of it's columns, a singleSelect type. The valueOptions for this column are taken from another .jsx file which returns a map, e.g. return [{"value": 'cat', "label": 'cat'}, {"value": 'dog', "label": 'dog'}];

The drop down within the column displays the values, however, when I select one of the value, say Cat 1, I get the following error:

"A component is changing the uncontrolled value state of Select to be controlled. Elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled Select element for the lifetime of the component. The nature of the state is determined during the first render. It's considered controlled if the value is not undefined."

The creation of the column is in myExample.jsx:

export default function myView() {
        const [data] = useState(getData());    
        const columns = [
        {
            field: "name",
            headerName: "Name",
            width: 100,
            type: "text",
            editable: true,
            align: 'left',
        },
        {
            field: "type",
            headerName: "Type",
            type: "singleSelect",
            width: 100,
            editable: true,
            valueOptions:  data,
            align: 'left',
        },
    ];

};

and the data comes from another file myData.jsx

export const getData = () => {
    return [{"value": 'cat', "label": 'cat'}, {"value": 'dog', "label": 'dog'}];
};

I'm new to React, so if anyone can help with this problem then I'd be very greatful.

Many thanks in advance.

about 4 years ago · Juan Pablo Isaza
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