Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.
key
(String
[optional]): If provided, the return value will be thethis.state[key]
of the root component instance.
const wrapper = mount(<MyComponent />);
expect(wrapper.state().foo).to.equal(10);
expect(wrapper.state('foo')).to.equal(10);