I recently converted my class component to a functional component using React Hooks and now some of my tests are failing. The error I get is:
ReactWrapper::state() can only be called on class components
and I think it's because in my test I use .state. Is there an alternative to this so my tests will pass now that I no longer have a class component?
it('sets field state isInputActive to true onFocus', () => {
const component = mount(<PinInput pin="123" onChange={() => {}} />);
expect(component.childAt(0).state('isInputActive')).toEqual(false);
component.find('.parental-pin__input-entry').simulate('click');
expect(component.childAt(0).state('isInputActive')).toEqual(true);
});