react-hook-loading

0.0.9 • Public • Published

react-hook-loading

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-hook-loading

Usage

App.js

import React from 'react'
import {LoadingProvider} from 'react-hook-loading'
import YourLoading from './YourLoading'
import Hello from './Hello'

export default function App(){
  return (
    <LoadingProvider loading={<YourLoading />}>
      <Hello/>
    </LoadingProvider>
  )
}

Hello.js

import React, {useEffect} from 'react'
import {useLoading} from 'react-hook-loading'

export default () => {
  const [loading, setLoading] = useLoading()
  useEffect(() => {
    setLoading(true)    // show modal loading
    setTimeout(() => {
      setLoading(false) // hide modal loading
    }, 2000)
  }, [])

  return <div>hello world</div>
}

License

MIT © min9nim

Readme

Keywords

none

Package Sidebar

Install

npm i react-hook-loading

Weekly Downloads

3

Version

0.0.9

License

MIT

Unpacked Size

14.3 kB

Total Files

6

Last publish

Collaborators

  • keating1729