-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.js
42 lines (36 loc) · 867 Bytes
/
index.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
/**
* Copyright (c) 2017-present, Justin Nguyen.
* All rights reserved.
*
* @author tuan3.nguyen@gmail.com
*
* @flow
* @format
*/
'use strict'
import React, { Component } from 'react'
import { Provider } from 'react-redux'
import { Router } from 'react-native-router-flux'
import createStore from './store/createStore'
import { scenes } from './routes/scenes'
export default class AppRoot extends Component {
constructor(props) {
super(props)
// Initial the store here so that it will not be re-created with hot reload.
const initialState = window.__INITIAL_STATE__
this.state = {
store: createStore(initialState)
}
}
renderApp() {
const { store } = this.state
return (
<Provider store={store}>
<Router scenes={scenes} />
</Provider>
)
}
render() {
return this.renderApp()
}
}