Skip to content

Fix key unicity on PitComponents#87

Open
sylvain-a wants to merge 1 commit into
airbnb:masterfrom
sylvain-a:master
Open

Fix key unicity on PitComponents#87
sylvain-a wants to merge 1 commit into
airbnb:masterfrom
sylvain-a:master

Conversation

@sylvain-a
Copy link
Copy Markdown

Hello guys,

thank you for this great component ! I use it in my project, that contains a lot of other REACT components. Unfortunately, I have warnings indicating that the key of the PitComponent is not unique. I quickly updated the value of the "key" attribute that is generating to make it more "unique"...
Does I missed something, or is that the good way to do it ?
Thanks,
Sylvain

Comment thread src/Slider.jsx

return (
<PitComponent key={n} style={pitStyle}>{n}</PitComponent>
<PitComponent key={`${n}_PC_${index}`} style={pitStyle}>{n}</PitComponent>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the pit points not unique?

Regardless, if there's nothing unique about the item, just key={index} is sufficient - anything else is just a waste.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I took the wrong direction. My first idea was to add small CSS blocs on top of others to manage the height of the pit points (that leads to not unique pit points...)

So if I have to put only 1 pit point per value, how do you manage the height of the point ? When the component is rendered outside the lib, I don't have enough information to calculate its height...

Thank you,
Sylvain

Copy link
Copy Markdown
Collaborator

@ljharb ljharb May 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goatslacker can probably help here

This comment was marked as off-topic.

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants