Code Monkey home page Code Monkey logo

rxx's Introduction

rxx

rxx is Model-View-Intent based minimal framework with Reactjs and RxJS.

  • We built more redux user friendly Model-View-Intent framework than cyclejs.
  • Asynchronous process is no more problem, StateHandler make it easy and clean.
  • Command line tool has been prepared! as @rxx/cli

Inspired by
cyclejs
redux
react-combinators
react-reactive-toolkit

First look !

import React from 'react';
import { Observable } from 'rxjs';
import { connect, reducer } from '@rxx/core';

function stream(source, initialState) {
  return {
    view: reducer(
      source,
      (states, payload) => {
        switch (payload.type) {
          case 'COUNTER::PLUS':
            return { ...states, count: states.count + 1 };
          case 'COUNTER::MINUS':
            return { ...states, count: states.count - 1 };
          default:
            return states;
        }
      },
      initialState
    )
  }
}

/**
 * Root component must decorated by connect like redux.
 */
@connect({
  mapIntentToProps(intent) {
    return {
      onPlus: intent.callback('COUNTER::PLUS'),
      onMinus: intent.callback('COUNTER::MINUS'),
    }
  },
  mapStateToProps(state) {
    return {
      value: state.counter.count
    }
  }
})
class View extends React.Component {
  render() {
    return (
      <div>
        <button onClick={this.props.onPlus}>Plus</button>
        <button onClick={this.props.onMinus}>Minus</button>
        <div>conter value is {this.props.value}</div>
      </div>
    );
  }
}

const view = makeView(<View/>);
const app = makeApp({counter: stream});
const Component = app(view({counter: {count: 0}}));

render(
  <Component />
  document.querySelector('#app')
);

Installation and setup

npm install @rxx/core

Guide

Architecture

architecture

Requirements

  • react >= 16.6.0
  • react-dom >= 16.6.0
  • rxjs >= 6.0.0 <= 6.3.3

Modules

rxx's People

Contributors

brn avatar

Stargazers

Pinyang Yuan avatar Sven Anders Robbestad avatar levelio avatar Javier Carrillo Milla avatar Alfonso Filho avatar y-unami avatar  avatar Brad Pillow avatar amobiz avatar Ricardo Lopez avatar Sean Ren avatar  avatar yuuki takezawa avatar Natsumi Kawakami avatar koji kashiwabara avatar Yuko avatar deadcheat avatar Yuta Igarashi avatar Henri Podolski avatar Amit Erandole avatar H avatar Pramendra Gupta avatar Timon van Spronsen avatar Matt Sylvia avatar  avatar Miki Oracle avatar  avatar Robbie dela Victoria avatar alwayrun avatar 1da avatar Josh Burgess avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

ryderjkl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.