I have a functional component which use useState in it. How can I test its state through jest?
I tried:
test('Test state', () => {
const wrapper = shallow(<MyComponent {...props}/>)
console.log(wrapper.state())
I receive this error:
ShallowWrapper::state() can only be called on class components
Aucun commentaire:
Enregistrer un commentaire