The Console.log(key,_i)
does work, but it does not render any thing.
return function doesn't render in React
I did try to put one more return following above question, but it does not help.
{newData?.data.forEach((x:any)=> {return (Object.keys(x).map((key:any,_i:number) => {
console.log(key,_i)
return (
<Grid item xs={12}>
<TextField
key={_i}
style={{ width: "100%" }}
required
label={key}
onChange={handleOnchange(key)}
/>
</Grid>
)
}))})}
It is expected to generate a text box. I did try to erase every thing in the <TextField>
like key
, style
,required
, label
, onChange
. But it still does not work. It is expected to render something.