All Projects → Vnkitaev → realt

Vnkitaev / realt

Licence: MIT license
Realt is a new way to work with Redux inspired by Alt

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to realt

redux-reducer-async
Create redux reducers for async behaviors of multiple actions.
Stars: ✭ 14 (-65.85%)
Mutual labels:  flux, flux-standard-action
Blazor Fluxor
DEPRECATED PROJECT. See FLUXOR
Stars: ✭ 216 (+426.83%)
Mutual labels:  flux
Retalk
🐤 The Simplest Redux
Stars: ✭ 168 (+309.76%)
Mutual labels:  flux
Metalhead.jl
Computer vision models for Flux
Stars: ✭ 191 (+365.85%)
Mutual labels:  flux
Geometricflux.jl
Geometric Deep Learning for Flux
Stars: ✭ 175 (+326.83%)
Mutual labels:  flux
Deox
Functional Type-safe Flux Standard Utilities
Stars: ✭ 200 (+387.8%)
Mutual labels:  flux
Redux Zero
A lightweight state container based on Redux
Stars: ✭ 1,977 (+4721.95%)
Mutual labels:  flux
react-store
Redux like store with React hooks and Context API
Stars: ✭ 16 (-60.98%)
Mutual labels:  flux
Smitty
Tiny flux implementation built on mitt
Stars: ✭ 210 (+412.2%)
Mutual labels:  flux
Bedrock
Build a Node web app with user authentication, security, and more in under 10 minutes. Now supports React Hot Loading for super-fast development. 👌
Stars: ✭ 187 (+356.1%)
Mutual labels:  flux
Typescript Webpack React Redux Boilerplate
React and Redux with TypeScript
Stars: ✭ 182 (+343.9%)
Mutual labels:  flux
Transformers.jl
Julia Implementation of Transformer models
Stars: ✭ 173 (+321.95%)
Mutual labels:  flux
Flooks
🍸 A state manager for React Hooks
Stars: ✭ 201 (+390.24%)
Mutual labels:  flux
General Store
Simple, flexible store implementation for Flux. #hubspot-open-source
Stars: ✭ 171 (+317.07%)
Mutual labels:  flux
Denormalizr
Denormalize data normalized with normalizr
Stars: ✭ 231 (+463.41%)
Mutual labels:  flux
Influxdb Client Python
InfluxDB 2.0 python client
Stars: ✭ 165 (+302.44%)
Mutual labels:  flux
Multi Tenancy
Flux v1: Manage a multi-tenant cluster with Flux and Kustomize
Stars: ✭ 180 (+339.02%)
Mutual labels:  flux
K8s Gitops
GitOps principles to define kubernetes cluster state via code. Community around [email protected] is on discord: https://discord.gg/7PbmHRK
Stars: ✭ 192 (+368.29%)
Mutual labels:  flux
nanoflux-fusion
Redux-like extension for Nanoflux
Stars: ✭ 15 (-63.41%)
Mutual labels:  flux
FluxJS.jl
I heard you like compile times
Stars: ✭ 43 (+4.88%)
Mutual labels:  flux

npm version

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
import { createAction } from 'realt';

const addText = createAction('addText');

expect(addText.toString()).toEqual('ADD_TEXT');

expect(addText('Hello world')).toEqual({
  type: 'ADD_TEXT',
  payload: 'Hello world'
});
Create from array
import { createActions } from 'realt';

const actions = createActions(['create', 'delete']);
Create from object
import { createActions } from 'realt';

const actions = createActions({
  create(id) {
    return id;
  },
  
  update(id, data) {
    return { id, data }
  }
});
Create from class
import { createActions } from 'realt';

class Actions {
  constructor() {
    this.generate(
      'create'
    );
  }

  update(id, data) {
    return { id, data };
  }
}

const actions = createActions(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
import { createReducer } from 'realt';

const initialState = [{
  id: 0,
  title: 'Use Realt',
}];

const reducer = createReducer({
  create(state, id) { // or handleCreate/reducerForCreate
    
  },
  
  update(state, id) { // or handleUpdate/reducerForUpdate
    
  }
}, initialState);
Create from class
import { createReducer } from 'realt';
import actions from '../actions';

class Reducer {
  constructor() {
    this.bindAction(actions.create, this.handleCreate);
    this.bindHandler(this.handleDelete, actions.delete);
  }

  get initialState() {
    return [{
      id: 0,
      title: 'Use Realt',
    }];
  }

  handleCreate(state, id) {
    return state.concat({ id, title: 'New entity' });
  }

  handleDelete(state, id) {
    return state.filter(entity => entity.id !== id);
  }
}

export default createReducer(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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].