我正在处理一个React项目,我使用功能组件和redux。我试图为我的RegisterForm组件编写测试,但是Jest和酶需要一个redux存储。我的组成部分:import axios from 'axios';
import { useSelector, useDispatch} from 'react-redux&
我有一个简单的Todo组件,它利用了redux钩子,我正在使用酶进行测试,但是我得到了一个错误,或者是一个带有浅渲染的空对象,如下所示。please ensure the component is wrappedTodos.test.js v2// imported Provider from react</e
当我尝试shallow(<LoginForm />)时,我得到以下错误Invariant Violation: Could not find react-redux context value; please另外,LoginForm使用了react钩子,包括一个useSelect钩子,所以将存储传递给我的组件属性不是我想要的解决方案。