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.

Nesting an If alongside an element causes key problems

See original GitHub issue

If you have something like this:

<If condition={aCondition}>
    <span>Blah</span>

    <If condition={anotherCondition}>
        <span>Other Blah</span>
    </If>
</If>

It seems to cause

warning.js:46 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `FeatureInfoSection`. See https://fb.me/react-warning-keys for more information.

Goes away if you do

<If condition={aCondition}>
    <span>Blah</span>

    <If condition={anotherCondition}>
        <span key='otherblah'>Other Blah</span>
    </If>
</If>

Looks like it’ll be an annoying fix 😦

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexGillerancommented, Aug 30, 2016

Fixed in v3.1.3! 💃

0reactions
stoikertycommented, Aug 30, 2016

works for me as well @texttechne thanks for the fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object spreads with nested children gives unwanted key ...
So I would like to know if this is correct behaviour or a bug. ... Render a component which spreads attributes on it's...
Read more >
Common nesting issues in HTML
Here are some examples of common nesting issues in HTML. ... Error message in the HTML validator: The element button must not appear...
Read more >
Vue deleting a nested loop element causes an error
Whenever I delete anything that is not the latest subrule it throws an error which is on the v-if statement in determining which...
Read more >
5.2. Data Access Pattern Problems
Inefficient loop nesting is a problem specific to algorithms that work on multidimensional arrays. If the array is traversed along the wrong axis...
Read more >
CSS Nesting Module
Abstract. This module introduces the ability to nest one style rule inside another, with the selector of the child rule relative to the ......
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