Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //actions
- export const SET_LANGUAGE = 'SET_LANGUAGE';
- export const setLanguage = language => ({
- type: SET_LANGUAGE,
- language
- });
- //reducers
- import {SET_LANGUAGE} from '../actions';
- const initialState = {
- language: 'en'
- };
- export const languageReducer = (state=initialState, action) => {
- if (action.type === SET_LANGUAGE) {
- return Object.assign({}, state, {
- language: action.language
- });
- }
- return state;
- };
Add Comment
Please, Sign In to add comment