Wyświetlam sobie nazwy, obok kazdej nazwy tworze button, po kliknieciu w button otwiera mi sie modal i chciałym aby w kazdym modalu byla przyporządkowana jedna zagadka dla danej nazwy. Proszę o pomoc.
state =
{history: [{Name:"nazwa1"},{Name:"nazwa2"},{Name:"nazwa3"}],
currentHistoryIndex: 0
}
render(){
return(
{this.state.history[this.state.currentHistoryIndex] && (
<ul>
{this.state.history[this.state.currentHistoryIndex].map((historyRecord, index) => {
return
<>
<li key={index}>{`Nazwa: ${historyRecord.Name}`}</li>
<button className="btn" onClick={this.openModal}>Zagraj</button>
</>
})}
</ul>
)}
)}