Mapping an index from an array

Hello everyone, I am trying to have a code that will return a random sentence from an array. Kind of like a random quote machine except it’s 3 different quotes on the page at the same time.
Here’s how it looks

<div className="">
          {this.state.first.map((first) => (
            <div className="">{first}</div>
          ))}
        </div>
        <div className="">
          {this.state.second.map((second) => (
            <div className="">{second}</div>
          ))}
        </div>
        <div className="">
          {this.state.third.map((third) => (
            <div className="">{third}</div>
          ))}
        </div>

What I want to do is have the map function only return one from each array. I tried this by doing this.

 {this.state.first.map((first) => (
            <div className="">{first[0]}</div>
          ))}

this gave me the first letter from each sentence in the array, which is pretty close after all.
But what am I missing to have it give me the whole sentence returning instead of just the first letter?

second: [
        "created Corona Virus  ",
        "released Covid-19 ",
        "created Covid-19",
        "bought Covid-19 from Wuhan",
        "created Covid-19",
        "ate bat soup",
        "Made 5G",
        "cancelled football",
        "bought covid-19 from aliens",
      ],

The array looks like this.
Thank you in advance.

If your array is an array of sentences, then you just need to use the element. In your example, first is the entire string that is an array element.

1 Like

How do I just use the element? if I use only {first} it gives me the entire array/

Sorry. You have two firsts. I meant the one in your map function.

Sorry for the late reply I had to go to work . So the array is called first, how do I use the map function only using the element? (If I am understanding you correctly)
Here is the code for the full page by the way, just in case I am not communicating well.

Why are you using map() if you only want the first array element?

That’s a good question, it’s because I was wrong.
I ended up finding the solution. I ended up using state instead of map, and just setting the state to be a random number each time the user clicks the button.
Thank you for your help!

Good job finding a solution! Happy coding.