UNPKG

823 BJavaScriptView Raw
1import { navigate } from './actions'
2import { render } from 'react-dom'
3import { Provider } from 'react-redux'
4import * as runtimes from './runtime/index'
5import history from './router/history'
6import React from 'react'
7
8export 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}