Doing this sounds pretty fragile. Do you have any guarantee that the
order of fields is the same as the order of the array? Even if that's
the case in your scenario, it's pretty uncommon.

On 24/04/2018 16:41, somonek wrote:
> The use case is: 
> (long story short)
> 
> I have an array of items coming from an api. They're converted to an
> object having the ids as keys for faster access of single items and
> loaded to a global store. 
> Then in React.js and I want to render only the first 2 items with a "See
> more" that would render the rest of them. 
> It would be handy (and probably more performant when the object is big
> as in my case) to have:
> 
> const product1 = myItems[in 0];
> const product2 = myItems[in 1];
> 
> instead of converting everything to an array first and then accessing
> the first items by index.
> 
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to