mercredi 9 décembre 2020

How to return a character n times before an element react

I want to add a random amount of characters before an element, repeat that element 20 times, with a diffrent amount of characters before each time. For example:

function App() {
  return (
    <>
      <h1>Hello World</h1>
      // I want to add a random amount of spaces before the h1 tags above. I also want to repeat that h1 tags 20 times with a diffrent amount of spaces before each h1 tag
    </>
  )
}

What I want to return is:

[Random amount of spaces between 1 and 10] Hello World

But there are 20 of them, each with a different amount of spaces.




Aucun commentaire:

Enregistrer un commentaire