Change component to use props.children

This commit is contained in:
dora 2021-05-07 23:35:50 -04:00
parent 36ccadcf62
commit 18a4034bcd
1 changed files with 5 additions and 6 deletions

View File

@ -1,14 +1,15 @@
import React from "react"; import { prependOnceListener } from "node:process";
import React, { Children, ReactElement } from "react";
import styles from './newscard.module.css' import styles from './newscard.module.css'
interface NewsCardProps { interface NewsCardProps {
date: Date; date: Date;
author: string; author: string;
content: string; children: ReactElement;
} }
const NewsCard: React.FC<NewsCardProps> = ({date,author,content}) => { const NewsCard: React.FC<NewsCardProps> = ({date,author,children}) => {
const options = {year:'numeric', month:'long',day:'numeric'}; const options = {year:'numeric', month:'long',day:'numeric'};
return( return(
@ -23,9 +24,7 @@ const NewsCard: React.FC<NewsCardProps> = ({date,author,content}) => {
{author} {author}
</div> </div>
<div className={styles.content}> <div className={styles.content}>
<p> {children}
{content}
</p>
</div> </div>
</div> </div>
) )