我有一个像这样的组件
Warning: Cannot update a component XXX while rendering a different component (`Unknown`). To locate the bad setState() call inside `Unknown`,
当我使用Jest和React Testing库测试该组件时。我说错了
setState
CLI突出显示了调用setState
的位置。因此,我认为模拟def contact_us(request):
if request.method == 'POST':
formq = forms.querys(request.POST)
if formq.is_valid():
obj = query()
obj.name = formq.cleaned_data['your_name']
obj.email = formq.cleaned_data['your_email']
obj.message = formq.cleaned_data['your_message']
obj.save()
return redirect(index)
else :
formq = forms.querys()
return render(request, 'home/contact_us.html', {'formq': formq})
可以解决此问题,但是我没有找到解决方案。