Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'react' from React;
- class Article extends Component {
- constructor(props) {
- super(props);
- }
- render() {
- const { article } = this.props;
- if (article.type === 'FullArticle') {
- return (
- <div>
- <h1>{article.title}</h1>
- <p>{article.content}</p>
- </div>
- );
- } else if (article.type === 'HealthArticle') {
- return (
- <div>
- <h1>{article.title}</h1>
- <h2>{article.subTitle}</h2>
- <p>{article.content}</p>
- </div>
- );
- }
- }
- }
- Article.propTypes = {
- article: PropTypes.object.isRequired,
- };
- export deafult Article;
Add Comment
Please, Sign In to add comment