effector-kit
v1.0.0
Published
🧰
Downloads
3
Readme
Effector kit
🧰
Installation
npm install effector effector-kit
or
yarn add effector effector-kit
Usage
getVoid:
sample({
source: initMapFx.done,
fn: getVoid,
target: createPopupFx,
});
getInverted:
sample({
source: $loader,
clock: guard($pending, { filter: getInverted }),
target: removeLoaderFx,
});
setPayload:
$countries.on(fetchCountriesFx.doneData, setPayload);
$schoolId.on(changeSchoolId, setPayload);
Helpers
export const getVoid = (payload?: unknown): void => undefined;
export const getInverted = (payload: unknown): boolean => !payload;
export const setBoolean = (state: unknown, value: unknown): boolean =>
Boolean(value);
export const setTrue = (state?: unknown, payload?: unknown): true => true;
export const setFalse = (state?: unknown, payload?: unknown): false => false;
export const setNull = (state?: unknown, payload?: unknown): null => null;
export const setPayload = <Payload = unknown>(
state: unknown,
payload: Payload
): Payload => payload;