Skip to content

Instantly share code, notes, and snippets.

View andycarrell's full-sized avatar

Andy Carrell andycarrell

View GitHub Profile
import { useState, useEffect, useCallback } from 'react'
function usePromise(createPromise) {
const [error, setError] = useState()
const [value, setValue] = useState()
useEffect(() => {
let current = true
createPromise().then(