I have my main component called App
.
App
pulls in the Table
component like so:
<Table
players={players}
/>
players
is initially defined in the App
component's state as an empty array but inside my Table
component I do this:
console.log(this.props.players, 'players');
Why would I get undefined
?
I also have this inside my App
component:
render() {
const { players, matches } = this.state;
Regarding my comment in your question you need to do something like this:
<Table
players={this.state.players}
/>
This way you are getting players from inside your state. Without "this.state" you will receive and undefined error