question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Immutable.KeyedIterable as children

See original GitHub issue

I’m aware of the Iterable support for children, but is there any timetable for supporting KeyedIterable from Immutable.js, specifically for automatically providing keys to children?

Sample use case:

var myItems = Immutable.Map({ // extends KeyedIterable
  one: 111,
  two: 222
});
var renderedItems = (
  <ul>{myItems.map(item => (
    <li>{item}</li>
  ))}</ul>
);

That is, the first item would end up the equivalent of <li key="one">111</li>.

If such support isn’t on the roadmap, can I somehow avoid having to use React.cloneElement() (which will have performance implications) if I write a helper function that does this?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
markuslernercommented, Jan 7, 2017

Same here. Any news on why React iterates both valueSeq() and entrySeq() twice? This still happens to me with React 15.4.2.

Using Immutable.Map.map() directly and ignoring the error “Using Maps as children is not yet fully supported” works fine though, which is weird.

1reaction
nikolas6commented, Feb 9, 2017

This happens to me too. React iterates entrySeq() twice. This is the first thread I found so far that mentioned this issue.

Just wondering, do you guys keep using entrySeq() that iterates twice? or using .toArray() first or .map() directly to iterate once?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collection.Keyed - Immutable.js
Returns a Seq.Keyed from this Iterable where indices are treated as keys. toKeyedSeq(): Seq.Keyed<K, V> ...
Read more >
What is the "correct" react way to update the state from a child ...
I want an user interaction on the child to update the state. Example of state: ... Will Immutable.js's KeyedIterable be the one to...
Read more >
Immutable JS - converting a collection of Maps to a List
the object is converted to immutable JS via fromJS(). I need a new object in the following structure: data :[{name: 'john', surname ...
Read more >
swagger-ui-dist - UNPKG
node_modules/immutable/dist/immutable.js","webpack://SwaggerUIBundle/./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js" ...
Read more >
https://fossies.org/linux/hhvm/hphp/hack/hhi/inter...
public function toValuesArray(): varray<Tv>; /** * Returns an immutable vector ... @return An `Iterable` with the values of the current `KeyedIterable`.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found