@vearvip/giao-hook
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@vearvip/giao-hook

组件功能描述

Install

$ npm i @vearvip/giao-hook --save

Usage

import React, { useEffect, useState } from 'react'
import { useAsyncGetState } from 'giao-hook' 

function App() {
  const [count1, setCount1, getCount1] = useAsyncGetState(10)
  const [count2, setCount2] = useState(0)

  async function changeCount1() {
    await setCount1(count1 + 1)
  }
  function changeCount2() {
    setCount2(getCount1() * 10)
  }

  useEffect(() => {
    changeCount1()
    changeCount2()
  }, [])

  return (
    <div> 
      <h2>count1: { count1 }</h2>
      <h2>count2: { count2 }</h2> 
    </div>
  );
}

export default App;

Package Sidebar

Install

npm i @vearvip/giao-hook

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

5.19 kB

Total Files

8

Last publish

Collaborators

  • vear