Answers for "render data through loop in react"

2

loop in react depending on number

const n = 8;
{[...Array(n)].map((elementInArray, index) => ( 
    <div className="" key={index}> Whatever needs to be rendered repeatedly... </div> 
    ) 
)}
Posted by: Guest on January-26-2022
0

react loop return

function Example(num){
    const output = new Array();
    for(let i = 0; i< num ; i++){
        output.push(<Component />)
    }
    return output;
}
  
 return(
   {get_comments(this.props.comments)}
   )
Posted by: Guest on April-22-2022

Code answers related to "render data through loop in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language