-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
index.tsx
38 lines (29 loc) · 908 Bytes
/
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
import React from "react"
import * as ReactDOM from "react-dom"
import { createHttpClient } from "mst-gql"
import { SubscriptionClient } from "subscriptions-transport-ws"
import "./index.css"
import { RootStore } from "./models/RootStore"
import { StoreContext } from "./models/reactUtils"
import { Home } from "./components/Home"
import { Profile } from "./components/Profile"
const gqlHttpClient = createHttpClient("http://localhost:4000/graphql")
const gqlWsClient = new SubscriptionClient("ws://localhost:4000/graphql", {
reconnect: true
})
const rootStore = RootStore.create(undefined, {
gqlHttpClient,
gqlWsClient
})
export const App = () => (
<StoreContext.Provider value={rootStore}>
<main>
<Home />
<Profile />
</main>
</StoreContext.Provider>
)
ReactDOM.render(<App />, document.getElementById("root"))
// For debugging
// @ts-ignore
window.store = rootStore