forked from cristi-salcescu/todo-search-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (26 loc) · 860 Bytes
/
main.js
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
import React from "react";
import ReactDOM from 'react-dom';
import TodoGateway from "./gateways/TodoGateway";
import UserGateway from "./gateways/UserGateway";
import TodoStore from "./stores/TodoStore";
import UserStore from "./stores/UserStore";
import TodoContainer from "./components/TodoContainer.jsx";
(function startApplication(){
const userGateway = UserGateway();
const todoGateway = TodoGateway();
const userStore = UserStore(userGateway);
const todoStore = TodoStore(todoGateway, userStore);
const stores = {
todoStore,
userStore
};
function loadStaticData(){
return Promise.all([userStore.fetch()]);
}
function mountPage(){
ReactDOM.render(
<TodoContainer stores={stores} />,
document.getElementById('root'));
}
loadStaticData().then(mountPage);
})();