useRootStore hook is just a way to get to the root store without explicitly declaring the store inside the component, it's just getting back the value that is stored in context, and if there is no context above, it throws.
3.Yes exactly :) You just need to guard against calling the hydration more than once, currently if will hydrate every time the Company component is rendered.
useRootStorehook is just a way to get to the root store without explicitly declaring the store inside the component, it's just getting back the value that is stored in context, and if there is no context above, it throws.3.Yes exactly :) You just need to guard against calling the
hydrationmore than once, currently if will hydrate every time theCompanycomponent is rendered.Well, if it's a global store, then you could just import it and directly mock the methods you want like so:
store.someMethod = jest.fn()