-
Notifications
You must be signed in to change notification settings - Fork 44
/
index.tsx
41 lines (35 loc) · 1.32 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { applyMiddleware, createStore } from "redux";
import { composeWithDevTools } from "redux-devtools-extension";
import createSagaMiddleware from "@redux-saga/core";
import "./index.css";
import App from "./App";
import rootReducer from "./store/Reducers";
import rootSagas from "./store/Sagas";
// A note about the use of redux here; a lot of inner deliberations were made
// before choosing to pull in both Redux and Sagas for this app. The idea is
// to keep this app mostly simple, but Redux and Sagas were pulled in for two
// major reasons:
//
// 1. We have to communicate data changes across the app to several components.
// 2. Redux makes managing complex state changes (such as filtering) easy.
//
// Yes, this is probably over-engineered, but Redux is the best tool for this
// potentially complex task. If you hate it, blame me and I'd be glad to bike
// shed about it with you. -ANM
const initialState = {};
const sagaMiddleware = createSagaMiddleware({});
const store = createStore(
rootReducer,
initialState,
composeWithDevTools(applyMiddleware(sagaMiddleware))
);
sagaMiddleware.run(rootSagas);
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById("root") as HTMLElement
);