A
A
Alex Polyakh2018-02-28 18:54:33
JavaScript
Alex Polyakh, 2018-02-28 18:54:33

When I render a list in the render method of React.JS, and I want to display only 'name' for example, I can't display the id. +name, what is the reason for this?

The code I wrote here: https://stackblitz.com/edit/react-7bygb1?file=index.js .
I use Immutable.js, I pass the id of the object I want to delete to the method, I display the rest of the elements using the map method.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-02-28
@PolyakhAleksandr

You need to convert the OrderedMap to an array before calling map . To do this, you can use the toArray method :

return arr.delete(id).toArray().map(item => <li key={item.id}>{item.name}</li>);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question