react-use icon indicating copy to clipboard operation
react-use copied to clipboard

useAsyncCache

Open natew opened this issue 6 years ago • 4 comments

Perhaps we could add a similar API to useAsync, but have it work with suspense. I understand react-cache will give us a pattern here, but what would be nice is a simple way to convert a useAsync function into a Suspense-style thrown promise.

natew avatar May 30 '19 00:05 natew

Could you please give a simple example?

streamich avatar Jul 16 '19 22:07 streamich

@streamich take a look at react-query and this: https://reactjs.org/docs/concurrent-mode-suspense.html

It's still experimental right now though

onionhammer avatar Jul 21 '20 16:07 onionhammer

Is there any progress? It will be cool to have a concurrent mode version useAsync

Jack-Works avatar Dec 21 '20 16:12 Jack-Works

+1

Maybe like https://github.com/vigzmv/react-promise-suspense ? Suspense-ized useAsync no longer needs properties for loading and error, and should return only value.

I am not sure if the name useAsyncCache is a good name.

yoshiko-pg avatar Jul 08 '22 08:07 yoshiko-pg