Skip to content

Instantly share code, notes, and snippets.

View cfogelklou's full-sized avatar

Chris Fogelklou cfogelklou

View GitHub Profile
@cfogelklou
cfogelklou / app-context.tsx
Last active May 12, 2023 07:21
This is an example of managing application state using the React Context API and the useReducer hook in typescript.
/*
This is an example of managing application state using the React Context API
and the useReducer hook in typescript. It demonstrates a pattern commonly
used in React applications to provide global state management and share state
and actions across components. It is all implemented in a single file for easy
copy/paste.
- Author: Chris Fogelklou
- Tags: useContext, Provider, useReducer, createContext