react-redux-pender
v0.1.0
Published
react-redux-pender
Downloads
2
Readme
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 { ... }