标签: unit-testing react-native testing jestjs enzyme
我有一个使用useState的功能组件。如何通过玩笑来测试其状态?
useState
我尝试过:
test('Test state', () => { const wrapper = shallow(<MyComponent {...props}/>) console.log(wrapper.state())
我收到此错误:
ShallowWrapper::state() can only be called on class components