use-safe-effect
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

use-safe-effect

npm version license


🏃 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')
  },
  []
)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.20latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.20
1.0.10
1.0.00
0.9.00
0.0.20
0.0.10

Package Sidebar

Install

npm i use-safe-effect

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

3.74 kB

Total Files

6

Last publish

Collaborators

  • zhusijia