Giter VIP home page Giter VIP logo

fluxible's Introduction

Fluxible

NPM version Build Status Coverage Status Dependency Status devDependency Status

Pluggable, singleton-free container for isomorphic Flux applications.

$ npm install --save fluxible

Join the #fluxible channel of the Reactiflux Slack community.

Gitter chat

Docs

Features

  • Singleton-free for server rendering
  • Store dehydration for client bootstrapping
  • Stateless async actions
  • Higher order components for easy integration
  • Enforcement of Flux flow - restricted access to the Flux interface from within components
  • Pluggable - add your own interfaces to the Flux context
  • Updated for React 0.13

Extras

Usage

import Fluxible from 'fluxible';
import React from 'react';
import {connectToStores, createStore, provideContext} from 'fluxible/addons';

// Action
const action = (actionContext, payload) => {
    actionContext.dispatch('FOO_ACTION', payload);
};

// Store
const FooStore = createStore({
    storeName: 'FooStore',
    handlers: {
        'FOO_ACTION': 'fooHandler'
    },
    initialize: () => { // Set the initial state
        this.foo = null;
    },
    fooHandler: (payload) => {
        this.foo = payload;
    },
    getState: () => {
        return {
            foo: this.foo
        }
    }
});

// Component
class App extends React.Component {
    render() {
        return <span>{this.props.foo}</span>
    }
}

App = provideContext(connectToStores(App, [FooStore], (stores, props) => {
    return stores.FooStore.getState();
}));

// App
const app = new Fluxible({
    component: App,
    stores: [FooStore]
});

// Bootstrap
const context = app.createContext();
context.executeAction(action, 'bar', (err) => {
    console.log(React.renderToString(context.createElement()));
});

License

This software is free to use under the Yahoo Inc. BSD license. See the LICENSE file for license text and copyright information.

fluxible's People

Contributors

abdullin avatar alexaivars avatar andrewraycode avatar antonklava avatar arturszott avatar bringking avatar bruderstein avatar cesarandreu avatar chriscorwin avatar gpbl avatar herzult avatar jaxoncreed avatar jedireza avatar joemcbride avatar juandopazo avatar jwalton avatar koulmomo avatar lingyan avatar lucianlature avatar mbfisher avatar mridgway avatar redonkulus avatar ross-pfahler avatar vijar avatar zeikjt avatar

Watchers

 avatar  avatar

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.