0.0.9 • Published 2 years ago

react-hook-loading v0.0.9

Weekly downloads
231
License
MIT
Repository
github
Last release
2 years ago

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

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago