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.

Style Guide: Keyed v-for (question)

See original GitHub issue

In instances when a good unique key does not exist for what you’re iterating over, is:

<li
    v-for="(item, index) in items"
    :key="index"
  >

Considered good or bad practice?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisvfritzcommented, Oct 12, 2017

This has been addressed now. 👍

1reaction
chrisvfritzcommented, Oct 1, 2017

Great question! I’d like to add that using the index can cause some serious performance issues. For example, let’s say the first item in the array is removed. if you use an index, Vue will assume the last element was removed and update every remaining element as it shifts everything down, thinking they’ve all changed. So you get the worst possible performance. 😢

@dannyrb Does that make sense? And do you think it would be helpful to add more information in the description for the rule?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eight questions to ask when creating a style guide | Brand8 PR
The questions to ask when creating a style guide · 1. What words do you, and don't you, want to say? · 2....
Read more >
How to Create a Brand Style Guide: 11 Essential Questions to ...
The Elements of a Brand Style Guide · 1. Mission Statement · 2. Target Audience · 3. Description of Your Visual Identity ·...
Read more >
Content style guide: A step-by-step guide to creating your own
This guide covers aspects of content style such as grammar, language, formatting, and tone—all the things needed to compose and present content.
Read more >
The Elements of a Style Guide | UX Magazine
Answering questions about your style guide's readers will help you adjust your message and tone according to your audience's level of expertise.
Read more >
6 Critical Components to Include in Your Style Guide
Style guides ensure branding stays consistent regardless of what is being created or who is creating it.
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