1 | import { navigate } from './actions'
|
2 | import { render } from 'react-dom'
|
3 | import { Provider } from 'react-redux'
|
4 | import * as runtimes from './runtime/index'
|
5 | import history from './router/history'
|
6 | import React from 'react'
|
7 |
|
8 | export default function runtimeRender(
|
9 | configureStore,
|
10 | {
|
11 | snap = true,
|
12 | runtime = 'Trails',
|
13 | // preferredSnapPoint = 90,
|
14 | ...initialState
|
15 | } = {}
|
16 | ) {
|
17 | const store = configureStore({
|
18 | router: {
|
19 | routes: {
|
20 | byContext: {},
|
21 | items: [],
|
22 | },
|
23 | parsers: initialState.router && initialState.router.parsers,
|
24 | },
|
25 | })
|
26 | store.dispatch(navigate(location.href))
|
27 |
|
28 | history(store)
|
29 |
|
30 | const Runtime = runtimes[runtime]
|
31 |
|
32 | render(
|
33 | <Provider store={store}>
|
34 | <Runtime snap={snap} />
|
35 | </Provider>,
|
36 | document.getElementById('root')
|
37 | )
|
38 |
|
39 | return store
|
40 | }
|