Download react-boilerplate/app/containers/LanguageProvider/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 529 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/containers/LanguageProvider/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/app/containers/LanguageProvider/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/containers/LanguageProvider/reducer.js
529 Bytes
| /* | |
| * | |
| * LanguageProvider reducer | |
| * | |
| */ | |
| import produce from 'immer'; | |
| import { CHANGE_LOCALE } from './constants'; | |
| import { DEFAULT_LOCALE } from '../../i18n'; | |
| export const initialState = { | |
| locale: DEFAULT_LOCALE, | |
| }; | |
| /* eslint-disable default-case, no-param-reassign */ | |
| const languageProviderReducer = (state = initialState, action) => | |
| produce(state, draft => { | |
| switch (action.type) { | |
| case CHANGE_LOCALE: | |
| draft.locale = action.locale; | |
| break; | |
| } | |
| }); | |
| export default languageProviderReducer; | |