Skip to content

Fix unique key issue when number has multiple of the same digit.#10

Open
altany wants to merge 1 commit into
RobertFOConnor:masterfrom
OLIOEX:fix-unique-key-issue
Open

Fix unique key issue when number has multiple of the same digit.#10
altany wants to merge 1 commit into
RobertFOConnor:masterfrom
OLIOEX:fix-unique-key-issue

Conversation

@altany
Copy link
Copy Markdown

@altany altany commented Jul 7, 2020

As reported here:
#1 (comment)

Hi @RobertFOConnor. This is still an issue in the latest version when there are two same digits in the number prop. I recommend you amend the index of the .map() to the data as a key, to ensure it will always be unique.

return (number + '').split('').map((data, index) => {
    <TextTicker
        key={`${data}${index}`}
        ...
    />
})

See screenshot when value is 199
image

By amending with the map index
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.

1 participant