A custom useState hook with support for Promise

Usage no npm install needed!

<script type="module">
  import useStatePromise from '';


Use State Promise

Star IT Ltd

An enhanced version of useState hook that returns asynchronous setter. Written in TS.

Installation & Usage

yarn add use-state-promise

import useStatePromise from 'use-state-promise';

export default function App() {
  const [data, setDataPromise, setData] = useStatePromise(10);
  return (
        onClick={() =>
          setDataPromise((curr) => curr + 1).then((state) => console.log('dom updated', state))
        click me!