Skip to content

Instantly share code, notes, and snippets.

@paulruescher
Last active December 4, 2015 23:23
Show Gist options
  • Save paulruescher/951dd64f489f1f97f16e to your computer and use it in GitHub Desktop.
Save paulruescher/951dd64f489f1f97f16e to your computer and use it in GitHub Desktop.
const Container = React.createClass({
componentDidMount() {
const success = (notifications) => {
this.setState({
notifications: notifications,
});
};
$.ajax({
url: '/notifications',
dataType: 'json',
success: success,
});
},
render() {
return (
<Presentation
notifications={this.state.notifications}
/>
);
},
});
const Presentation = React.createClass({
renderNotification({message, date}) {
return <div>{message} — {date}</div>;
},
render() {
return <div>{this.props.notifications.map(renderNotification)}</div>;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment