SHARE
TWEET

Untitled

a guest Jan 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top