I have an array of object that get users data using fetch API. I have tried constructor, create a function, bind it. It didn\'t work. I tried ComponentDidMount and setState, it
First initialize your state in your constructor like this
constructor(props) { super(props); this.state = {users : []} //initialize as array }
Then instead of that.state = {users: json}; set your state using
that.state = {users: json};
that.setState({ users: json });