react-json-stream
react > stream > json
Last updated 5 years ago by ramitos .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-json-stream 
SYNC missed versions from official npm registry.

react-json-stream

install

npm install --save react-json-stream

example

var JSON = require('jsonstream2');
var React = require('react-json-stream');


var App = React.createClass({
  getInitialState: function() {
    return {
      i: 0
    };
  },
  componentDidMount: function() {
    this.interval = setInterval(this.tick, 500);
  },
  componentWillUnmount: function() {
    clearInterval(this.interval);
  },
  tick: function() {
    this.setState({
      i: this.state.i + 1
    });
  },
  render: function() {
    return (<ul>
      <li key='my-li'>{this.state.i}</li>
    </ul>);
  }
});

var str = React.render(React.createElement(App));
str.pipe(JSON.stringify()).pipe(process.stdout);

setTimeout(function() {
  React.unmountComponentAtNode(str);
}, 2000);
[{
  "children": [],
  "parent": "",
  "name": "ul",
  "id": ".0",
  "props": {},
  "content": null
}, {
  "children": [{
    "children": [],
    "parent": ".0",
    "name": "li",
    "id": ".0.$my-li",
    "props": {
      "key": "my-li"
    },
    "content": 1
  }],
  "parent": "",
  "name": "ul",
  "id": ".0",
  "props": {},
  "content": null
}, {
  "children": [{
    "children": [],
    "parent": ".0",
    "name": "li",
    "id": ".0.$my-li",
    "props": {
      "key": "my-li"
    },
    "content": 2
  }],
  "parent": "",
  "name": "ul",
  "id": ".0",
  "props": {},
  "content": null
}, {
  "children": [{
    "children": [],
    "parent": ".0",
    "name": "li",
    "id": ".0.$my-li",
    "props": {
      "key": "my-li"
    },
    "content": 3
  }],
  "parent": "",
  "name": "ul",
  "id": ".0",
  "props": {},
  "content": null
}]

license

BSD-3-Clause

Current Tags

  • 1.0.9                                ...           latest (5 years ago)

9 Versions

  • 1.0.9                                ...           5 years ago
  • 1.0.7                                ...           5 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (19)
Dev Dependencies (9)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |