Skip to content

usePromistate improvements

Latest
Compare
Choose a tag to compare
@MZanggl MZanggl released this 24 Jan 12:32

React's version of promistate now allows passing a dependencies array to update the callback in case it depends on local state (same as React's useCallback).

const [search, setSearch] = React.useState('')

usePromistate(() => fetchArticles(search), {}, [search])

Additionally, some types have been improved.