1.0.2 • Published 4 years ago

use-safe-effect v1.0.2

Weekly downloads
17
License
MIT
Repository
github
Last release
4 years ago

use-safe-effect

npm version license


:running: Throw away the Promise,Choose Async/Await

Installation

npm install use-safe-effect --save

Examples

import useSafeEffect from 'use-safe-effect'

useSafeEffect(async () => console.log('componentDidMount'), () => console.log('componentWillUnMount'), [])
import useSafeEffect from 'use-safe-effect'
import request from 'umi-request'

useSafeEffect(
  async () => {
    let res = await request(api)
    console.log('componentDidMount')
  },
  () => {
    console.log('componentWillUnMount')
  },
  []
)
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.9.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago