Skip to content

Instantly share code, notes, and snippets.

View juangl's full-sized avatar
🐝
Undefined

Juan Je García juangl

🐝
Undefined
View GitHub Profile
import React, { useCallback } from 'react';
type FetchReducerActions<DataT> =
| { type: 'REQUEST_START' }
| { type: 'REQUEST_SUCCESS'; payload: DataT }
| { type: 'REQUEST_ERROR'; error: Error }
| { type: 'FETCH_NEXT_PAGE' }
// use to fetch again after an error
| { type: 'RETRY' };