11# react-with-spinner
2+
23[ ![ Build Status] ( https://travis-ci.org/beanloop/react-with-spinner.svg?branch=master )] ( https://travis-ci.org/beanloop/react-with-spinner )
34[ ![ npm version] ( https://badge.fury.io/js/react-with-spinner.svg )] ( https://badge.fury.io/js/react-with-spinner )
45[ ![ License] ( http://img.shields.io/:license-mit-blue.svg )] ( http://doge.mit-license.org )
56
67React HOC for displaying a Spinner component while loading.
78
89## Install
9- ```
10+
11+ ``` shell
1012yarn add react-with-spinner
1113npm install --save react-with-spinner
1214```
1315
1416## Usage
17+
1518By default withSpinner will look for the property ` data ` and if
1619that property contains an loading property that is true then
1720it will render a ` Spinner ` .
@@ -22,7 +25,7 @@ import {withSpinner} from 'react-with-spinner'
2225
2326const Component = compose (
2427 WrappedComponent => props => <WrappedComponent {... props } data ={{loading: true }} />,
25- withSpinner (),
28+ withSpinner ({spinnerComponent: SomeCustomSpinnerConponent } ),
2629)(() => <div ></div >)
2730
2831```
@@ -40,24 +43,9 @@ const Component = compose(
4043
4144```
4245
43- The ` spinnerComponent ` defaults to a React Toolbox ProgressBar component. However, it is possible
44- to provide your own component:
45-
46- ``` typescript
47- import compose from ' recompose/compose'
48- import {withSpinner } from ' react-with-spinner'
49-
50- const Loading = () => <span >Loading ... < / span >
51-
52- const Component = compose (
53- WrappedComponent => props => <WrappedComponent {... props } data ={{loading: true }} />,
54- withSpinner ({spinnerComponent: Loading }),
55- )(() => <div ></div >)
56-
57- ```
58-
5946For more usages, check out the [ tests] ( https://github.com/beanloop/react-with-spinner/blob/master/src/index.test.tsx )
6047
6148## License
49+
6250react-with-spinner is dual-licensed under Apache 2.0 and MIT
6351terms.
0 commit comments