Answer the question
In order to leave comments, you need to log in
How to parse such a json object?
Good afternoon!
It comes from the json server, then I translate it into an object through JSON.parse(). Then I want to display its contents like this: Object.keys(this.state.students).map(function (val){return });
But in reality, one empty element is rendered, and the error "Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `RenderStudent`" is thrown.
Answer the question
In order to leave comments, you need to log in
try this
Object.keys(this.state.students).map(
(el, ind)=>{
<div key={el.id}>{el.name}</div>
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question