https://github.com/beanloop/react-with-spinner
React HOC for displaying a Spinner component while loading.
https://github.com/beanloop/react-with-spinner
higher-order-component loading-spinner spinner
Last synced: 9 months ago
JSON representation
React HOC for displaying a Spinner component while loading.
- Host: GitHub
- URL: https://github.com/beanloop/react-with-spinner
- Owner: beanloop
- License: apache-2.0
- Created: 2017-03-17T09:52:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T08:14:58.000Z (about 3 years ago)
- Last Synced: 2025-04-15T11:40:42.183Z (9 months ago)
- Topics: higher-order-component, loading-spinner, spinner
- Language: TypeScript
- Homepage:
- Size: 2.2 MB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# react-with-spinner
[](https://travis-ci.org/beanloop/react-with-spinner)
[](https://badge.fury.io/js/react-with-spinner)
[](http://doge.mit-license.org)
React HOC for displaying a Spinner component while loading.
## Install
```shell
yarn add react-with-spinner
npm install --save react-with-spinner
```
## Usage
By default withSpinner will look for the property `data` and if
that property contains an loading property that is true then
it will render a `Spinner`.
```typescript
import compose from 'recompose/compose'
import {withSpinner} from 'react-with-spinner'
const Loading = () => Loading...
const Component = compose(
WrappedComponent => props => ,
withSpinner({spinnerComponent: Loading}),
)(() =>
)
```
You can override which property withSpinner should look for:
```typescript
import compose from 'recompose/compose'
import {withSpinner} from 'react-with-spinner'
const Component = compose(
WrappedComponent => props => ,
withSpinner({prop: 'result'}),
)(() =>
)
```
For more usages, check out the [tests](https://github.com/beanloop/react-with-spinner/blob/master/src/index.test.tsx)
## License
react-with-spinner is dual-licensed under Apache 2.0 and MIT
terms.