Skip to content

Instantly share code, notes, and snippets.

@gHashTag
Created April 1, 2017 01:26
Show Gist options
  • Save gHashTag/2b558a9d2ba4f436e6793d0744685b85 to your computer and use it in GitHub Desktop.
Save gHashTag/2b558a9d2ba4f436e6793d0744685b85 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, combineReduxers, compose } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import reducer from './app/reducers'
// middleware that logs actions
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ })
function configureStore(initialState) {
const enhancer = compose(
applyMiddleware(
thunkMiddleware, // lets us dispatch() functions
loggerMiddleware,
),
);
return createStore(reducer, initialState, enhancer)
}
const store = configureStore({})
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native'
export default class Peckish extends Component {
render() {
return (
<View>
<Text>
Welcome to React Native!
</Text>
</View>
)
}
}
const App = () => (
<Provider store={store}>
<Peckish />
</Provider>
)
AppRegistry.registerComponent('Peckish', () => App)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment