Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react recursive component

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

  return (
    <>
      {name}
      {hasChildren && items.map((item) => (
        <RecursiveComponent key={item.name} {...item} />
      ))}
    </>
  )
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js add element to array 
Javascript :: if js 
Javascript :: encode password javascript 
Javascript :: js output to console 
Javascript :: vue compare two dates 
Javascript :: threemeshphonematerial url image three js 
Javascript :: how to create request body javascript 
Javascript :: react-moralis 
Javascript :: react function 
Javascript :: js map array to object 
Javascript :: enforcefocus select2 modal 
Javascript :: array of obj to obj with reduce 
Javascript :: document get child element by id 
Javascript :: vuejs show content on loaded 
Javascript :: onfocus 
Javascript :: js array as parameter 
Javascript :: change inptu val 
Javascript :: start animation with javascript 
Javascript :: sort numbers in array in js 
Javascript :: json stringify number 
Javascript :: why navlink in react router always active 
Javascript :: use of split and join 
Javascript :: alert javascript 
Javascript :: javascript substring 
Javascript :: async function in variable 
Javascript :: sticky sessions 
Javascript :: how to use hidden value in javascript using getelementbyid 
Javascript :: javascript array sorting 
Javascript :: experss cookie session 
Javascript :: prettier printWidth 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =