6 ms·
immutable.js for what? Seems to me you're picking up hear-say here and there but why and for what would you want to use immutable. Even redux docs speak out aga
by mlsarecmg 9y ago
immutable.js for what? Seems to me you're picking up hear-say here and there but why and for what would you want to use immutable. Even redux docs speak out against it. It's just a random tool like any other, you're assuming it has some deeper significance with react, it doesn't.
> be constantly aware of small quirks like keys when looping
There are no "quirks" in looping anything. It is plain javascript. I would call "v-for" a quirk on the other hand.
const array = []
for (let item of items)
array.push(<li>{item.text}</li>)
render (
<ul>
{array}
</ul>
)
Recreate the snippet above, then let's discuss.
- mikewhy 9y agoDoesn't that produce the "array items should have key prop" message? Also you can use `items.map` in your example.
- mlsarecmg 9y agoI only wanted to show that react doesn't specify a programming style. He said javascript maps are "quirky." Maps are fine but so are plain loops. Ternaries are fine, so are plain if-then-else constructs if someone would like it better that way. The example would run without keys, it's merely for demonstration. You'd need keys in Vue as well.