Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 702 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 702 Bytes

Syncano-React - React wrapper for Syncano JS library

Installation

npm install git+https://[email protected]/mkucharz/syncano-react.git

Using mixin

import React from 'react';
import { Mixin } from 'syncano-react';

export default React.createClass({
  displayName: 'Test',

  mixins: [Mixin('dry-glitter-4206', '849d42539b5a3820fc7ee84243cb8a37a65824a5')],

  getInitialState() {
    return {color: null};
  },

  componentDidMount() {
    this.connectState('color', {syncanoClass: 'color', objectId: 1283});
  },

  render() {
    return (
      <div>
        <pre>{this.state.color ? JSON.stringify(this.state.color, null, 2) : 'No object'}</pre>
      </div>
    );
  }
});