Neo's Playing Morpheus

    react-jonathan

    0.0.3 • Public • Published

    Jonathan

    React Mixins for Jonathan Simple JSON API Server

    Usage

    var React = require("react");
    var jonathan = require("react-jonathan");
    var Api = jonathan.Api;
    
    var Sample = React.createClass({
        mixins: [ Api ],
      
        getInitialState: function () {
            return {
                content: null
            };
        },
      
        api: "/api/sample",
      
        onLoad: function (json) {
            this.setState({content: json.content});
        },
      
        render: function () {
            var content;
            if (this.state.content) {
                content = (
                      <div>
                          You received content: {this.state.content}
                      </div>
                  );
            }
        
            return (
                <div>
                    {content}
                </div>
            );
        }
    });
    
    React.render(<Sample />, document.body);
    

    Install

    npm install --save react-jonathan

    Install

    npm i react-jonathan

    DownloadsWeekly Downloads

    7

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • rudolph-miller