Open cossack910 opened 11 months ago
必要なものだけ
import { CommentInterface } from "./interface/comment";
const dotComCheckFunc = (text: string) => {
if (~text.indexOf(".com")) {
return true;
}
return false;
};
export const Comment = (
props: Pick<CommentInterface, "body" | "id" | "email">←これ
) => {
const { body, id, email } = props;
const emailDotComCheck: string = dotComCheckFunc(email)
? "[.com]"
: "[ドットコム違う]";
return <p>{`${emailDotComCheck}..${body}(コメントID:${id})`}</p>;
};
export default Comment;
不要なものを取り除く
import { CommentInterface } from "./interface/comment";
const dotComCheckFunc = (text: string) => {
if (~text.indexOf(".com")) {
return true;
}
return false;
};
export const Comment = (
props:Omit<CommentInterface, "postId" | "name">←これ
) => {
const { body, id, email } = props;
const emailDotComCheck: string = dotComCheckFunc(email)
? "[.com]"
: "[ドットコム違う]";
return <p>{`${emailDotComCheck}..${body}(コメントID:${id})`}</p>;
};
export default Comment;
interface