1.0.2 • Published 4 months ago

async-use-state v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

async-use-state

A React hook for managing state with async callbacks.

Installation

npm install async-use-state

usage

import React from "react";
import asyncUseState from "async-use-state";

const App = () => {
  const [count, setCount] = asyncUseState(0);

  const increment = () => {
    setCount(count + 1, (updatedCount) => {
      console.log("State has been updated:", updatedCount);
      // Perform async actions here
    });
  };

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={increment}>Increment</button>
    </div>
  );
};

export default App;
1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago