🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

noflux

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noflux

a simple top down data flow implementation

latest
Source
npmnpm
Version
2.2.4
Version published
Maintainers
1
Created
Source

Build Status

noflux

a simple top down data flow implementation.

install

npm install noflux

usage

import {connect, state} from "noflux";
import React from "react";

state.load({
  name: 'jack'
});

@connect
export default class extends React.Component {
    render() {
        return (
            <div>
                <input onChange={e => state.set('name', e.target.value)} />
                <p> hello, my name is {state.get('name')} </p>
            </div>
        )
    }
}

The page will be refresh once the state changes.

API

connect

a function works as decrocation to bind a React class with state. state will emit change event after its modification and the instance of the class will be re-rendered.

pure

a function works as decrocation to make a React class as a pure render component even though you pass cursors as props.

state

A instance of dataton which implemented Copy-On-Write technique. You can:

  • load: load data into state.
  • set: set specific key-value for state.
  • get: get the correspond value for the provided key.
  • cursor: get the cursor from the provided path.

License

MIT

Keywords

flux

FAQs

Package last updated on 07 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts