Guest User

Untitled

a guest
Jun 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import React from 'react';
  2. import { AppRegistry } from 'react-native';
  3.  
  4. import {Provider} from 'react-redux';
  5. import {createStore, applyMiddleware } from 'redux';
  6. import promiseMiddleware from 'redux-promise';
  7.  
  8. import reducers from './src/store/reducers';
  9.  
  10. import App from './App';
  11.  
  12. const createStoreWithMiddleware = applyMiddleware(promiseMiddleware)(createStore)
  13.  
  14. const appRedux = () => (
  15. <Provider store={createStoreWithMiddleware()}>
  16. <App />
  17. </Provider>
  18. )
  19.  
  20. AppRegistry.registerComponent('ProjectThree', () => appRedux);
  21.  
  22. import {combineReducers} from 'redux';
  23. import article_reducer from './article_reducer';
  24.  
  25. const rootReducer = combineReducers({
  26. article_reducer
  27. })
  28.  
  29. export default rootReducer;
  30.  
  31. export default function(state={}, action){
  32. switch(action.type){
  33. case 'GET_ARTICLES' :
  34. return {...state, articles : action.payload}
  35. default :
  36. return state;
  37. }
  38. }
Add Comment
Please, Sign In to add comment