在我的render中,我触发了一个函数来将用户重定向到不同的页面,但是我得到了一个错误的Cannot update during an existing state transition (suchas within render)。我注意到,如果我将redirectToPath函数(在render中)放在setTimeout中,它允许状态完成转换,错误也就消失了。如果我将hist
我有检查表单填写是否正确的代码-如果填写不正确,应该会弹出一个对话框,让用户知道它没有正确填写。我不明白为什么这对我不起作用。 在onSubmit中称为renderError弹出窗口。state = { }
this.setState(prevState => ({ errorOpen/*Code that checks and sets the submit to true/false*