Guest User

Untitled

a guest
May 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import 'react' from React;
  2.  
  3. class Article extends Component {
  4. constructor(props) {
  5. super(props);
  6. }
  7.  
  8. render() {
  9. const { article } = this.props;
  10. if (article.type === 'FullArticle') {
  11. return (
  12. <div>
  13. <h1>{article.title}</h1>
  14. <p>{article.content}</p>
  15. </div>
  16. );
  17. } else if (article.type === 'HealthArticle') {
  18. return (
  19. <div>
  20. <h1>{article.title}</h1>
  21. <h2>{article.subTitle}</h2>
  22. <p>{article.content}</p>
  23. </div>
  24. );
  25. }
  26. }
  27. }
  28.  
  29. Article.propTypes = {
  30. article: PropTypes.object.isRequired,
  31. };
  32.  
  33. export deafult Article;
Add Comment
Please, Sign In to add comment