@rogal/async-render
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.3 • Public • Published

async-render NPM Version NPM Downloads Actions Status Actions Status Coverage Status

async-render gives you a component to show spinners after a timeout until suspense is ready

Install

npm install @rogal/async-render --save

Getting Started

In this example the h1 element will be shown after 2s

import React from 'react'
import {
  AsyncRender
} from '@rogal/async-render';

const App = () => {
  return (
    <AsyncRender loading>
      <h1>hello</h1>
    </TranslateProvider>
  )
}

How to increase the timeout

The timeout by default is 2000, so you can increase giving the prop timeout

import React from 'react'
import {
  AsyncRender
} from '@rogal/async-render';

const App = () => {
  return (
    <AsyncRender loading timeout={4000}>
      <h1>hello</h1>
    </TranslateProvider>
  )
}

Props

Name Type Default
loading Boolean none
children React.Node none
timeout number 2000

How to contribute

You can install and have an enviroment ready for use with Storybook

  npm i
  npm start

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @rogal/async-render

Weekly Downloads

0

Version

1.0.0-beta.3

License

MIT

Unpacked Size

7.99 kB

Total Files

8

Last publish

Collaborators

  • gabrielseco