Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

mobx-deku

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-deku

mobx bindings for deku

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

mobx-deku

Package with deku component wrapper for combining deku with mobx. Exports the observer function decorator. For documentation, see the mobx project.

npm install mobx-deku

Boilerplate Projects that use mobx-deku

  • Minimal MobX, deku, ES6, JSX, Hot reloading: mobx-deku-boilerplate

API documentation

observer(component)

Function that converts a Deku component definition or stand-alone render function into a reactive component. See the mobx documentation for more details.

import {observer} from "mobx-deku";

const TodoView = observer({
    render({props}) {
        return <div>{props.todo.title}</div>
    }
}));

Full Example

import {render, tree} from 'deku';
import element from 'magic-virtual-element';
import {observable} from 'mobx';
import {observer} from 'mobx-deku';

class AppState {
  @observable counter = 0;
  increaseCounter () {
    this.counter += 1;
  }
}
const appState = new AppState();

const App = observer({
  render ({props}) {
    return (
      <div>
        <div class='app'>{props.appState.counter}</div>
        <button onClick={onClick}>+</button>
      </div>
    );
    function onClick () {
      props.appState.increaseCounter();
    }
  }
});

render(tree(<App appState={appState} />), document.createElement('div'));

Special thanks to mobx-react and @mattmccray's gist

Keywords

mobx

FAQs

Package last updated on 01 Aug 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