Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/javascript/components/Comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react"
import PropTypes from "prop-types"
class Comment extends React.PureComponent {
render () {
return (
<div>
<div>Author: {this.props.author}</div>
<div>Text: {this.props.text}</div>
</div>
);
}
}

Comment.propTypes = {
author: PropTypes.node,
text: PropTypes.node
};
export default Comment
1 change: 1 addition & 0 deletions app/views/welcome/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<%= javascript_pack_tag 'application' %>
<%= react_component 'Post', { title: 'A working react component', body: 'Simple but effective' }, prerender: true %>
<%= react_component 'Comment', { author: 'Tim', text: 'Simple but effective' }, prerender: true %>