react-loading-spinner

Loading spinner component for React

Usage no npm install needed!

<script type="module">
  import reactLoadingSpinner from 'https://cdn.skypack.dev/react-loading-spinner';
</script>

README

React loading spinner

Loading spinner component for React

Installation

npm install -save react-loading-spinner

Usage

Show loading spinner when content is loading and show content when it is loaded.

<Loading isLoading={this.props.isLoadingContent}
         loadingClassName='loading'
         spinner={Spinner}>
  {this.props.content ? (
    <Content />
  ) : null}
</Loading>

You can also assign content as a prop:

<Loading isLoading={this.props.isLoadingContent} children={Content} />

See example

Options

isLoading

It is the state of loading spinner, if true — show spinner, otherwise show content if it is exist.

spinner

Set react component, as a custom spinner. If it is not exist there will be default spinner.

loadingClassName

Style class name for loading wrapper. By default — loadingContiner

children

Assign child component as a property.

License

MIT