2
export default class Usuariobox extends Component{
constructor() {
super();
this.state = {lista: []};
}
componentDidMount(){
this.Listar();
}
Listar(){
axios.get('http://localhost:8000/user').then(function(resposta){
this.setState({lista: $(resposta.data)});
}.bind(this));
}
render(){
return(
<div>
<FormUsuario Listar={this.Listar()} />
<TabelaUsuario lista={this.state.lista} Listar={this.Listar} />
</div>
);
}
}
When I go up the server the browser starts crashing and when I go to see in the network the same is doing infinite user requests in the api, I believe the error is in Formusuario Listar={this. List()} /> but don’t know how to solve. Any hints?