mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 10:07:35 +00:00
Introduce Redux into the modern skin codebase
This commit is contained in:
parent
c23b2b4171
commit
86684cd0ce
3 changed files with 27 additions and 1 deletions
|
|
@ -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
18
modern/src/store.ts
Normal 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
2
modern/src/types.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export type ModernAppState = {};
|
||||
export type ModernAction = { type: "INIT" };
|
||||
Loading…
Add table
Add a link
Reference in a new issue