typeless

typeless

  • Docs
  • API
  • Github

›API Reference

Introduction

  • Quick Start
  • Motivation
  • Examples
  • Starters Kits
  • Roadmap

Using typeless

  • HMR
  • Code-Splitting

API Reference

  • createModule
  • createSelector
  • useActions
  • useMappedState
  • useSelector
  • ChainedReducer
  • Epic
  • Handle
  • Rx

API Reference (router)

  • createUseRouter
  • RouterActions
  • getRouterState
  • Link

API Reference (form)

  • createForm
  • FormActions

Handle

Handle is an object created by createModule. It allows attaching epic handlers and reducers.

Mounting handle

Returned handle by createModule is a React hook function. Invoke it to mount it in the application.

Example

// module.ts
import { handle } from './interface';

// export it with `use` prefix
export const useMyModule = handle;

// or use directly in the module component
export function MyModule() {
  handle();

  return (
    <div>foo</div>
  )
}

Methods

epic()

Initialize a new epic. Epics are used to handle side effects.
Calling epic() multiple times will reset previously created epic.

Returns

{Epic} - the created epic

Example

import { handle } from './interface';

handle.epic()
  .on(SomeActions.foo, () => {...})
  .on(SomeActions.bar, () => {...})

reducer(initialState: TState)

Initialize a new chained reducer. Reducers are used to modify the state.
Calling reducer() multiple times will reset previously created reducer.

Arguments

  1. initialState: object- the initial state.

Returns

{ChainedReducer} - the created chained reducer

Example

import { handle } from './interface';

handle.reducer({user: null, isLoading: false})
  .on(SomeActions.foo, () => {...})
  .on(SomeActions.bar, () => {...})

reset()

Reset created epic and reducer.

← EpicRx →
  • Mounting handle
  • Methods
    • epic()
    • reducer(initialState: TState)
    • reset()
typeless
Docs
Getting StartedAPI Reference
Community
Spectrum
More
GitHub
Copyright © 2020 Łukasz Sentkiewicz