We'd suggest improving the naming of the states in this file. oneName is a bit confusing because it's an array and name is confusing as it's a string of multiple names.
Our suggestion to implement the functionality of changing the name when the user clicks Next Player:
- Create another state for the array index, for instance [playerId, setPlayerId]
- Add an onlick to the Next Player button along the lines of setPlayerId(function to create random number)
We'd suggest improving the naming of the states in this file. oneName is a bit confusing because it's an array and name is confusing as it's a string of multiple names.
Our suggestion to implement the functionality of changing the name when the user clicks Next Player: