github.com/wfusion/gofusion@v1.1.14/common/infra/asynq/asynqmon/ui/src/index.tsx (about) 1 import React from "react"; 2 import ReactDOM from "react-dom"; 3 import CssBaseline from "@material-ui/core/CssBaseline"; 4 import { Provider } from "react-redux"; 5 import App from "./App"; 6 import store from "./store"; 7 import parseFlagsUnderWindow from "./parseFlags"; 8 import * as serviceWorker from "./serviceWorker"; 9 import { saveState } from "./localStorage"; 10 import { SettingsState } from "./reducers/settingsReducer"; 11 12 parseFlagsUnderWindow(); 13 14 let currentSettings: SettingsState | undefined = undefined; 15 store.subscribe(() => { 16 const prevSettings = currentSettings; 17 currentSettings = store.getState().settings; 18 19 // Write to local-storage only when settings have changed. 20 if (prevSettings !== currentSettings) { 21 saveState(store.getState()); 22 } 23 }); 24 25 ReactDOM.render( 26 <React.StrictMode> 27 <CssBaseline /> 28 <Provider store={store}> 29 <App /> 30 </Provider> 31 </React.StrictMode>, 32 document.getElementById("root") 33 ); 34 35 // If you want your app to work offline and load faster, you can change 36 // unregister() to register() below. Note this comes with some pitfalls. 37 // Learn more about service workers: https://bit.ly/CRA-PWA 38 // TODO(hibiken): Look into this. 39 serviceWorker.unregister();