memberHoax

memberHoax

Source:
See:
  • module:memberHoax.makeMemberProvider

makeMemberHoax factory.

Example

import { makeMemberHoax } from "react-hoax";

const initialState = {
  name: ""
};

const UserHoax = makeMemberHoax("user", { initialState });
const NameField = UserHoax.Field.Input({fieldKey: "name"});

const UserForm = () => (
  <UserHoax.Provider>
    <NameField />
  </UserHoax.Provider>
);

Members

(private, static, constant) initialState

Source:
Default Value:
  • { loading: true, loaded: false, processing: false, errors: {} }

Methods

(private, static) makeReducer(getInitialState, customReducer) → {memberHoax.ReducerWithInit}

Source:
Parameters:
Name Type Description
getInitialState function

a function that returns the initialState

customReducer function

a custom reducer

Returns:
Type
memberHoax.ReducerWithInit

(private, static) makeUseSelector(StateCtx, DispatchCtx) → {memberHoax.Selectors}

Source:
Parameters:
Name Type Description
StateCtx object

the context with the member state

DispatchCtx object

the context with the member dispatches / actions

Returns:
Type
memberHoax.Selectors

Type Definitions

ReducerWithInit

Source:
Properties:
Name Type Description
reducer function

the reducer to be used along with provider

init function

the function to initialize the reducer's state

Type:
  • Object

Selectors

Source:
Properties:
Name Type Description
useSelector function

useSelector(state => state) select a part of member's state

useAction function

useAction('actionName') select the action you need to dispatch for the member

Type:
  • Object