Is it possible to connect non component Class to redux store? Is it possible to connect non component Class to redux store? reactjs reactjs

Is it possible to connect non component Class to redux store?


The connect function is not going to work with anything other than React components. What you can do is pass your store instance to your class and call store.dispatch, store.getState, and store.subscribe directly.

Keep in mind that if you subscribe, you should also have functionality to unsubscribe, otherwise your store will be holding a reference to your class instance forever, creating a memory leak.