0.1.0 • Published 7 years ago

react-redux-pender v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

react-redux-pender

Make your components wait for the data, that they need, by displaying your preloader component.

How to install

yarn install react-redux-pender

How to use

Create pender decorator using createPender function, into which you can pass any pure component, which will be used as preloader.

pender decorator takes a function, which takes your state as a first parameter and props of decorated component as a second, and returns either boolean, Array<boolean> or Object<key, boolean>. Once all of provided booleans are false, your component is rendered.

Example

import React from 'react';
import createPender from 'react-redux-pender';
import Preloader from '../compontents/preloader';


const pender = createPender(Preloader);

@pender((state, props) => state.customers.pending)
export default class MyAwesomeComponent extends Component { ... }

Made with love by

npm.io