-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathRoot.js
45 lines (40 loc) · 956 Bytes
/
Root.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const h = require('react-hyperscript')
const { Provider: ReduxProvider } = require('react-redux')
const { ConnectedRouter } = require('react-router-redux')
const { IntlProvider } = require('react-intl')
const { StyleProvider } = require('./createStyle')
const getLocaleMessages = require('./lib/getLocaleMessages')
module.exports = Root
function Root (props) {
const {
history,
store,
locale = navigator.language,
messagesByLocale,
styleRenderer,
styleNode,
styleTheme,
children
} = props
const messages = getLocaleMessages(messagesByLocale, locale)
return (
h(ReduxProvider, {
store
}, [
h(StyleProvider, {
renderer: styleRenderer,
mountNode: styleNode,
theme: styleTheme
}, [
h(IntlProvider, {
locale,
messages
}, [
h(ConnectedRouter, {
history
}, children)
])
])
])
)
}