Skip to content

Instantly share code, notes, and snippets.

View saddacracker's full-sized avatar
🎯
Focusing

John Cardwell saddacracker

🎯
Focusing
View GitHub Profile
@saddacracker
saddacracker / SampleReducerWithContext.js
Last active February 15, 2023 17:30
useContext, useReducer example with Local Storage
// Persist Application State locally with useReducer & useContext.
// AppReducer.js
export const initialState = {
number: 0,
}
export const AppReducer = (state, action) => {
switch (action.type) {
case 'REPLACE_STATE':
@saddacracker
saddacracker / gist:530ed4d69dba39e79d46
Created November 4, 2014 04:53
Override and extend Backbone Marionette Regions for Custom Fading
// Regions
//
// Extend the Backbone.Marionette Regions for custom functionality
MWP.module('Common.Regions', function(Regions, MWP, Backbone, Marionette, $, _) {
// Overlays
Regions.Overlay = Marionette.Region.extend({