Currently I am working inside of a functional component, and trying to set state based on a prop that's getting passed into it.
if (prop){
contextProvider.updateText()
}
Context provider code
const updateText = () => {
setButtonState({text: "testing"})
}
this results in
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.
Any advice on how to resolve this would be greatly appreciated
Aucun commentaire:
Enregistrer un commentaire