html-react-parser
html-react-parser copied to clipboard
Warning: Each child in a list should have a unique "key" prop.
I'm in this kind of a situation where I should pass a unique key to the function, but couldn't do it.
const options = {
key:"1"
}
{content.map((obj, i) => {
return <>
{ReactHtmlParser(somelist[i], options)}
{obj}
</>
})}
What is the proper way of doing this?
I'm in this kind of a situation where I should pass a unique key to the function, but couldn't do it.
const options = { key:"1" } {content.map((obj, i) => { return <> {ReactHtmlParser(somelist[i], options)} {obj} </> })}
What is the proper way of doing this?
Try this...
<div> {data.map((item, index) => ( <React.Fragment key={index}> {parse(item)} </React.Fragment> ))} </div>
@libensvivit did @ReinheimerPiano's answer help you?
Closing issue due to lack of activity. Feel free to reopen if you have additional questions.