Skip to content

Commit

Permalink
Warning Issue Handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ryusudol committed Nov 10, 2023
1 parent aab8b52 commit 801420c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions front-end/components/Questions/AnswerSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ import React, { useEffect, useState } from 'react';
import AnswerDetail from './AnswerDetail';
import { Answer } from 'types/Course';

interface Type {
id: number;
contents: string;
createdAt: Date;
author: { email: string };
type PropsType = {
answers: Answer[];
}
};

const AnswerSet = ({ answers }: any): JSX.Element => {
const AnswerSet = ({ answers }: PropsType): JSX.Element => {
const [orderedAnswer, setorderedAnswer] = useState<Answer[]>([]);

useEffect(() => {
const orderedDate = answers?.sort(
(a: Type, b: Type) =>
(a: Answer, b: Answer) =>
new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime(),
);
setorderedAnswer(orderedDate);
Expand Down

0 comments on commit 801420c

Please sign in to comment.