Skip to content
Discussion options

You must be logged in to vote

key is a prop that react uses under the hood to correctly re-render elements in a list when it's modified. just add it as a component prop of each item you push to the array:

icon.push(<CreditCardIcon key="credit-card" />);
icon.push(<GlobalGlobeIcon key="global-globe" />);
icon.push(<MusicIcon key="music" />);

keys should be static and unique.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KoichaDev
Comment options

Answer selected by KoichaDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants