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.