this is file app.js
...
constructor(props) {
super(props);
this.state = {
todoLists: [],
inputValue: "",
currentName: "",
todoSearch: "",
idUpdate: "",
loader: true
};
}
componentDidUpdate(){
this.setState({
loader: true
})
}
componentDidMount() {
axios
.get("https://5ec912d99ccbaf0016aa8b6f.mockapi.io/todoLists")
.then((res) => {
this.setState({
loader: false,
todoLists: res.data
});
});
}
...
i added componentDidUpdate in my App but it message : Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
Aucun commentaire:
Enregistrer un commentaire