-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrender.js
More file actions
40 lines (35 loc) · 823 Bytes
/
render.js
File metadata and controls
40 lines (35 loc) · 823 Bytes
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
import { navigate } from './actions'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import * as runtimes from './runtime/index'
import history from './router/history'
import React from 'react'
export default function runtimeRender(
configureStore,
{
snap = true,
runtime = 'Trails',
// preferredSnapPoint = 90,
...initialState
} = {}
) {
const store = configureStore({
router: {
routes: {
byContext: {},
items: [],
},
parsers: initialState.router && initialState.router.parsers,
},
})
store.dispatch(navigate(location.href))
history(store)
const Runtime = runtimes[runtime]
render(
<Provider store={store}>
<Runtime snap={snap} />
</Provider>,
document.getElementById('root')
)
return store
}