diff --git a/app/javascript/components/Comment.js b/app/javascript/components/Comment.js new file mode 100644 index 0000000..35c1ed7 --- /dev/null +++ b/app/javascript/components/Comment.js @@ -0,0 +1,18 @@ +import React from "react" +import PropTypes from "prop-types" +class Comment extends React.PureComponent { + render () { + return ( +
+
Author: {this.props.author}
+
Text: {this.props.text}
+
+ ); + } +} + +Comment.propTypes = { + author: PropTypes.node, + text: PropTypes.node +}; +export default Comment diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 4dd0f9d..d8856bf 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -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 %>