From 86684cd0ce122ecd4aa63df94c3346b6890b89ea Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 12 Aug 2019 15:13:06 -0700 Subject: [PATCH] Introduce Redux into the modern skin codebase --- modern/src/index.js | 8 +++++++- modern/src/store.ts | 18 ++++++++++++++++++ modern/src/types.ts | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 modern/src/store.ts create mode 100644 modern/src/types.ts diff --git a/modern/src/index.js b/modern/src/index.js index 96b217bf..82af9da9 100644 --- a/modern/src/index.js +++ b/modern/src/index.js @@ -1,10 +1,16 @@ import React from "react"; import ReactDOM from "react-dom"; +import { Provider } from "react-redux"; import "./index.css"; import App from "./App"; import Debugger from "./debugger"; +import { create } from "./store"; + +const store = create(); ReactDOM.render( - window.location.pathname === "/debugger" ? : , + + {window.location.pathname === "/debugger" ? : } + , document.getElementById("root") ); diff --git a/modern/src/store.ts b/modern/src/store.ts new file mode 100644 index 00000000..9c4584e9 --- /dev/null +++ b/modern/src/store.ts @@ -0,0 +1,18 @@ +import { ModernAppState, ModernAction } from "./types"; +import { createStore } from "redux"; + +const defaultState = {}; + +function reducer( + state: ModernAppState = defaultState, + action: ModernAction +): ModernAppState { + switch (action.type) { + default: + return state; + } +} + +export function create() { + return createStore(reducer); +} diff --git a/modern/src/types.ts b/modern/src/types.ts new file mode 100644 index 00000000..6eb3f2dd --- /dev/null +++ b/modern/src/types.ts @@ -0,0 +1,2 @@ +export type ModernAppState = {}; +export type ModernAction = { type: "INIT" };