Realt
Realt is a new way to work with Redux inspired by Alt
If you want to skip the docs and jump straight to the code, you should check out /examples folder, there you'll find some of Redux examples migrated to realt
Getting Started
Install
npm install --save realt
Actions
createAction(actionName: string)
createAction(actionName: string, payloadCreator: function)
createAction(actionName: string, namespace: string)
createAction(actionName: string, payloadCreator: function, namespace: string)
createActions(Actions: object|array|function)
createActions(Actions: object|array|function, namespace: string)
Examples
Create single action
; const testAction =
Create from array
; const actions =
Create from object
; const actions = ;
Create from class
; { this; } { return id data ; } const actions = ;
ActionsClass.generate(…actionNames: string)
You can use this method in ActionsClass constructor, it'll setup actions which simply pass forward all incoming data
Note: all of the generated actions will receive only 1 parameter, so your data should be wrapped in an object
Reducer
createReducer(Reducer: object|function)
createReducer(Reducer: object|function, initialState: any)
createReducer(Reducer: object|function, namespace: string)
createReducer(Reducer: object|function, initialState: any, namespace: string)
Examples
Create from object
; const initialState = id: 0 title: 'Use Realt'; const reducer = ;
Create from class
;; { this; this; } { return id: 0 title: 'Use Realt' ; } { return state; } { return state; } Reducer;
ReducerClass.initialState
Here you must bring an initial snapshot of your view's state
ReducerClass.bindHandler(reducerHandler: function, actionCreator: object)
ReducerClass.bindAction(actionCreator: object, reducerHandler: function)
This method is a bridge between your reducer and certain action type. When you call it, you're connecting the data flow from some action right into the store