I am in the middle of my first React Native project. I would like to create a HOC that deals exclusively with data synchronization with api. After that, all other components will be transferred.
If I am right, my DataSync
component DataSync
enhance all other components by following the export statement:
export default DataSync(SomeOtherComponent);
The concept I'm SomeOtherComponent
with is that SomeOtherComponent
also depends on the React Redux Connect method to retrieve another reduction state. My question is: how can I use both together? Something like that?
export default DataSync(connect(mapStateToProps, mapDispatchToProps)(SomeOtherComponent));
Perhaps I completely misunderstood this concept, so I would really appreciate some pointers
EDIT
Further clarify:
My DataSync HOC will cleanly handle data synchronization between the application and will be a top-level component. It will need access to auth state and will install data in Redux (in this case orders) for all other components.
The components embedded in the DataSync HOC need access to the extracted data, routes, and they, in turn, create a state (orders), which must be periodically synchronized with the server.
source share