refactor: use redux

This commit is contained in:
boojack
2022-05-21 12:21:06 +08:00
parent 2e9152e223
commit c2e5a1a524
45 changed files with 674 additions and 1101 deletions

View File

@ -1,8 +1,8 @@
import React from "react";
import { createRoot } from "react-dom/client";
import Provider from "./labs/Provider";
import appContext from "./stores/appContext";
import appStore from "./stores/appStore";
import { Provider } from "react-redux";
import store from "./store";
import { updateStateWithLocation } from "./store/modules/location";
import App from "./App";
import "./helpers/polyfill";
import "./less/global.less";
@ -12,8 +12,15 @@ const container = document.getElementById("root");
const root = createRoot(container as HTMLElement);
root.render(
<React.StrictMode>
<Provider store={appStore} context={appContext}>
<Provider store={store}>
<App />
</Provider>
</React.StrictMode>
);
window.onload = () => {
store.dispatch(updateStateWithLocation());
window.onpopstate = () => {
store.dispatch(updateStateWithLocation());
};
};