From 813c5e7eda90944733d60dd324459ced93c9c087 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 20 Dec 2017 13:28:12 +0300 Subject: initial demo --- vnext/src/app.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 vnext/src/app.js (limited to 'vnext/src/app.js') diff --git a/vnext/src/app.js b/vnext/src/app.js new file mode 100644 index 00000000..52f35076 --- /dev/null +++ b/vnext/src/app.js @@ -0,0 +1,34 @@ +import "whatwg-fetch" +import React, {PropTypes} from "react" +import ReactDOM from "react-dom" + +import Message from "./components/Message.jsx" + +const Page = React.createClass({ + getInitialState() { + return {msgs: [], loading: false} + }, + propTypes: { + msgs: PropTypes.array, + source: PropTypes.string.isRequired + }, + render() { + var nodes = this.state.msgs.map(msg => { + return () + }); + return (
{nodes}
) + }, + componentDidMount() { + fetch(this.props.source) + .then(response => { + return response.json() + }) + .then(data => + this.setState({ msgs: data }) + ).catch(ex => { + console.log(ex) + }); + } +}); + +ReactDOM.render(, document.getElementById("content")); \ No newline at end of file -- cgit v1.2.3