react-redux-pender
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-redux-pender

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • zepod