redux-queue-offline-listener
v0.2.1
Published
Network listener for redux-queue-offline
Downloads
12
Readme
redux-queue-offline-listener
You can use the NetworkListener high order component to wrap the redux Provider and automatically dispatch the ONLINE and OFFLINE action when listening to window.on('online')
and window.on('online')
.
import NetworkListener from 'redux-queue-offline-listener';
import { Provider } from 'react-redux';
const NetworkListenerProvider = NetworkListener(Provider);
ReactDOM.render(
<NetworkListenerProvider store={store}>
<MyRootComponent />
</NetworkListenerProvider>,
rootEl
)
React Native
You can use redux-queue-offline-listener/lib/native
to use React Native NetInfo
import NetworkListener from 'redux-queue-offline-listener/native';
import { Provider } from 'react-redux';
const NetworkListenerProvider = NetworkListener(Provider);
AppRegistry.registerComponent('HelloWorldApp', () =>
<NetworkListenerProvider store={store}>
<MyRootComponent />
</NetworkListenerProvider>
)
License
MIT