Answers for "how to render a component multiple times in react"

0

javascript render jsx element x many times

const n = 8;

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

how to render a component multiple times in react

ReactDOM.render(
  <>
   { [...Array(8)].map( ( el, i) => (    <App key={i}/> ) ) }
  </>,
  document.getElementById('root')
);
Posted by: Guest on October-23-2021

Code answers related to "how to render a component multiple times in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language