Answers for "react recursive component"

0

react recursive component

const RecursiveComponent = ({ name, items }) => {
  const hasChildren = items && items.length

  return (
    <>
      {name}
      {hasChildren && items.map((item) => (
        <RecursiveComponent key={item.name} {...item} />
      ))}
    </>
  )
}
Posted by: Guest on October-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language