DEV Community

jars06
jars06

Posted on

A help with this select with material react table

Hello, I have the following problem: On page load I have a useEffect that returns an x number of records with the following format:
TBLNAME: 'Table1'
TBLNAME: 'Table2'
TBLNAME: 'Table3'
.......
And this is the code to load the select:

const [selectTables, setSelectTabless] = useState([]);
.........

<FormControl variant="standard" sx={{ m: 1, minWidth: 350 }}>
   <InputLabel >Tablas cargadas</InputLabel>
   <Select
      id="selecttable"
      key={values.iD}
      name={"Tabla"}
      //onChange={(e) =>
      //setValues({ ...values, [e.target.name]: e.target.value })
      // }
    >
    {selectTables.map((table, index) =>
      <menuitem >
      {table}
      </menuitem >
      )}
    </Select>
</FormControl>
Enter fullscreen mode Exit fullscreen mode

When I want to display the select, I get the following error:
"Objects are not valid as a React child (found: object with keys {TABLE_NAME}). If you meant to render a collection of children, use an array instead."

Any help please.
Thank you

Top comments (0)