C# developer here. I would like to ask how can I add a values to a class.
This is my class:
class Players {
constructor(playerOne, playerTwo) {
this.playerOne = playerOne;
this.playerTwo = playerTwo;
}
}
Here I call it's constructor:
handleClick() {
this.setState({ clicked: true });
Players(
document.getElementById("Select_Player1").value,
document.getElementById("Select_Player2").value
);
console.log(Players.playerOne);
console.log(Players.playerTwo);
}
And I export it at the end of file:
export { Players };
After clicking on button which execute handleClick()
application return an error: TypeError: Cannot call a class as a function
.