-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
executable file
·47 lines (39 loc) · 1.14 KB
/
App.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
46
47
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import userReducers from '@reducers/userLoginReducers'
import MainRoute from '@routes'
import { createStore, combineReducers } from 'redux'
import { Provider } from 'react-redux'
import { connect } from 'react-redux'
import { addNavigationHelpers } from 'react-navigation'
import { ApolloProvider } from 'react-apollo'
import { ApolloClient, HttpLink, InMemoryCache } from 'apollo-client-preset'
const httpLink = new HttpLink({ uri: 'https://api.graph.cool/simple/v1/cjb30vkvv434c0146sjjn4d4w' })
const client = new ApolloClient({
link: httpLink,
cache: new InMemoryCache()
})
let store = createStore(combineReducers({userReducers}))
export default class App extends Component<{}> {
render() {
return (
<ApolloProvider client={client} store={store}>
<NaviState />
</ApolloProvider>
);
}
}
const mapStateToProps = (state) => state
// create a component
class MyClass extends Component {
render() {
return (
<MainRoute />
);
}
}
const NaviState = connect(mapStateToProps)(MyClass)