Created
October 9, 2018 14:43
-
-
Save martink-io/ce81eeaab1694b6fd04583e0cceb36fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {Platform, StyleSheet, Text, View} from 'react-native'; | |
import { Provider } from 'react-redux'; | |
import { createStore, applyMiddleware, compose} from 'redux'; | |
import thunkMiddleware from 'redux-thunk'; | |
import createLogger from 'redux-logger'; | |
import reducer from './app/reducers'; | |
import DashboardContainer from './app/containers/DashboardContainer'; | |
const instructions = Platform.select({ | |
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu!!', | |
android: | |
'Double tap R on your keyboard to reload,\n' + | |
'Shake or press menu button for dev menu!!', | |
}); | |
// middleware that logs actions | |
// const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ }); | |
function configureStore(initialState) { | |
const enhancer = compose( | |
applyMiddleware( | |
thunkMiddleware, // lets us dispatch() functions | |
), | |
); | |
return createStore(reducer, initialState, enhancer); | |
} | |
const store = configureStore({}); | |
export default class App extends Component { | |
render() { | |
return ( | |
<Provider store={store}> | |
<DashboardContainer/> | |
</Provider> | |
); | |
} | |
} |
Yes its is better this way
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could this be changed:
to this one?
Don't think the App needs to extend from Component as it's an entry point rather than an actual component. What do you think?