Skip to content

Instantly share code, notes, and snippets.

View Brenndoerfer's full-sized avatar
👨‍💻

Michael Brenndoerfer

👨‍💻
View GitHub Profile
@Brenndoerfer
Brenndoerfer / genericContextProvider.tsx
Created September 5, 2021 09:36
Generic Context.Provider for React
import React, { ReactNode, useReducer } from 'react';
interface Reducer<T, R extends ActionProps> {
(state: T, action: R): any;
}
interface Dispatch<T extends ActionProps> {
(action: T): void;
}