Guest User

Untitled

a guest
Jan 18th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. //actions
  2. export const SET_LANGUAGE = 'SET_LANGUAGE';
  3. export const setLanguage = language => ({
  4. type: SET_LANGUAGE,
  5. language
  6. });
  7.  
  8.  
  9. //reducers
  10.  
  11. import {SET_LANGUAGE} from '../actions';
  12.  
  13. const initialState = {
  14. language: 'en'
  15. };
  16.  
  17. export const languageReducer = (state=initialState, action) => {
  18. if (action.type === SET_LANGUAGE) {
  19. return Object.assign({}, state, {
  20. language: action.language
  21. });
  22. }
  23. return state;
  24. };
Add Comment
Please, Sign In to add comment