/*prettydiff.com spaceclose:false, varword:list*/
var ListItem = React.createClass({
render: function () {
return (
this.props.item.name
);
}
});
var List = React.createClass({
renderList: function () {
return this.props.items.map(function (item) {
return ;
});
},
render: function () {
return
}
});
var Mist = React.createClass({
renderList: function () {
return this.props.items.map(function (item) {
return {item}} key={item.id} />;
});
}
});
var content = (
{/* child comment, put {} around */}
);
var qwer = A dropdown list Do Something Do Something Fun! Do Something Else ; render(dropdown);
// JSX
var box =
{shouldShowAnswer(user) ?
no :
Text Content
}
;
var a = function () {return asdf ;};
var HelloMessage = React.createClass({
render: function() {
return Hello {this.props.name}
;
}
});
React.render( , mountNode);
var Timer = React.createClass({
getInitialState: function() {
return {secondsElapsed: 0};
},
tick: function() {
this.setState({secondsElapsed: this.state.secondsElapsed + 1});
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 1000);
},
componentWillUnmount: function() {
clearInterval(this.interval);
},
render: function() {
return (
Seconds Elapsed: {this.state.secondsElapsed}
);
}
});
React.render( , mountNode);
var Timer = React.createClass({
getInitialState: function() {
return {secondsElapsed: 0};
},
tick: function() {
this.setState({secondsElapsed: this.state.secondsElapsed + 1});
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 1000);
},
componentWillUnmount: function() {
clearInterval(this.interval);
},
render: function() {
return (
Seconds Elapsed: {this.state.secondsElapsed}
);
}
});
React.render( , mountNode);
var TodoList = React.createClass({
render: function() {
var createItem = function(itemText) {
return {itemText} ;
};
return {this.props.items.map(createItem)} ;
}
});
var TodoApp = React.createClass({
getInitialState: function() {
return {items: [], text: ''};
},
onChange: function(e) {
this.setState({text: e.target.value});
},
handleSubmit: function(e) {
e.preventDefault();
var nextItems = this.state.items.concat([this.state.text]);
var nextText = '';
this.setState({items: nextItems, text: nextText});
},
render: function() {
return (
TODO
);
}
});
React.render( , mountNode);
var converter = new Showdown.converter();
var MarkdownEditor = React.createClass({
getInitialState: function() {
return {value: 'Type some *markdown* here!'};
},
handleChange: function() {
this.setState({value: this.refs.textarea.getDOMNode().value});
},
render: function() {
return (
);
}
});
React.render( , mountNode);
import React from 'react';
class MyComponent extends React.Component {
render() {
var a = 1;
return (
Test
);
}
}
export const Welcome = ({name}) => (
Hello, {name}.
);
ReactDOM.render(, document.getElementById('app'), asdf);
class Header extends Component {
renderLinks() {
if (this.props.authenticated) {
return (
a
)
} else {
return [ Sign in ,
Sign Up ]
}
}
}
export default class kisharNine extends Component {
constructor(props) {
super(props);
}
render() {
return (
{
const nextIndex = route.index + 1;
navigator.push({
title: 'Scene ' + nextIndex,
index: nextIndex,
});
}}
// Function to call to go back to the previous scene
onBack={() => {
if (route.index > 0) {
navigator.pop();
}
}}
/>
}
/>
);
}
}