Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

michaelcontento/redux-middleware-react-native-netinfo

Repository files navigation

license npm version npm downloads Code Climate build

Glue NetInfo from react-native to Redux.

Deprecated - No longer maintained

My focus has left the node / react ecosystem and this module is no longer maintained.

Thank you for your patience and using this module in the first place!

Installation

npm install --save redux-middleware-react-native-netinfo

Usage

// Just import the middleware and add it to your store
import { createStore, applyMiddleware } from 'redux';
import { middleware as netInfo } from 'redux-middleware-react-native-netinfo';
const createStoreWithMiddleware = applyMiddleware(netInfo)(createStore);

// And in your reducers receive the value
import { TYPE as NET_INFO } from 'redux-middleware-react-native-netinfo';

function netInfoReducer(state = {}, action) {
    switch (action.type) {
        case NET_INFO:
            console.log('NetInfo:', action.payload);

        default:
            return state;
    }
}

Todo

  • Write tests for everything!

About

Glue NetInfo from react-native to Redux

Resources

License

Stars

Watchers

Forks

Packages

No packages published