Answers for "how to add a key to every html tag in a list react"

0

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>
        )
      })
Posted by: Guest on March-28-2022

Code answers related to "how to add a key to every html tag in a list react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language