Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to add a key to every html tag in a list react

//if you have a list of html tags passed like a prop to a component maybe
// you will get the each child in a list should have a unique "key" error
// to solve that you can wrap every html element in the list with a <Fragment>
props.htmlElementsList.map(item => {
        return(
           <Fragment key={anykey}>{item}</Fragment>
        )
      })
 
PREVIOUS NEXT
Tagged: #add #key #html #tag #list #react
ADD COMMENT
Topic
Name
8+9 =