javascript `createNamespaceReducer`的基本用法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript `createNamespaceReducer`的基本用法相关的知识,希望对你有一定的参考价值。
import { createNamespaceReducer, createReducer } from '@ghadyani-framework/redux-utils'
import {
LOADED,
LOADING,
} from './actions'
export const initialState = false
export const reducerActions = {
[LOADED]: () => initialState,
[LOADING]: () => true,
}
const isLoadingReducer = (
createReducer(
reducerActions,
initialState,
)
)
export default (
createNamespaceReducer(
isLoadingReducer,
)
)
export const LOADED = 'INDICATORS::LOADED'
export const LOADING = 'INDICATORS::LOADING'
export const setLoaded = (
namespace,
) => ({
namespace,
type: LOADED,
})
export const setLoading = (
namespace,
) => ({
namespace,
type: LOADING,
})
以上是关于javascript `createNamespaceReducer`的基本用法的主要内容,如果未能解决你的问题,请参考以下文章
javascript JavaScript isset()等效: - JavaScript
JavaScript 使用JavaScript更改CSS(JavaScript)
JavaScript之基础-1 JavaScript(概述基础语法)
前端基础-JavaScript的基本概述和语法
JavaScript
JavaScript