Introduce Redux into the modern skin codebase

This commit is contained in:
Jordan Eldredge 2019-08-12 15:13:06 -07:00
parent c23b2b4171
commit 86684cd0ce
3 changed files with 27 additions and 1 deletions

View file

@ -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" ? <Debugger /> : <App />,
<Provider store={store}>
{window.location.pathname === "/debugger" ? <Debugger /> : <App />}
</Provider>,
document.getElementById("root")
);

18
modern/src/store.ts Normal file
View file

@ -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);
}

2
modern/src/types.ts Normal file
View file

@ -0,0 +1,2 @@
export type ModernAppState = {};
export type ModernAction = { type: "INIT" };