I am trying to implement the approach from the link below for the dynamic loading of the reducers using typescript. Can someone please suggest a way to access the store and call the store's custom method to inject the reducer.
https://tylergaw.com/articles/dynamic-redux-reducers/
This is the conversion of the withReducer
const withReducer = (key:any, reducer:any) => (WrappedComponent:any) => {
const Extended: React.FunctionComponent<any> = (props, context) => {
context.store.injectReducer(key, reducer)
return <WrappedComponent {...props} />
};
Extended.contextTypes = {
store: object
};
return Extended;
};
export { withReducer };
How can I get access to the store here. The context.store is undefined.