-
-
Save RyotoNoguchi/7b02834771eb5852e3e898ba97903d93 to your computer and use it in GitHub Desktop.
Sample of a functional components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
export type Choices = { | |
A: string | |
B: string | |
C: string | |
D: string | |
} | |
export type QuestionType = { | |
id: string | |
question: string | |
answer: string | |
choices: Choices | |
} | |
const SampleQuestion: React.VFC<QuestionType> = ({id, question, answer, choices}) => { | |
return ( | |
<div> | |
<h1>問題{id}</h1> | |
<h2>問題文:{question}</h2> | |
<ul> | |
<li>選択肢A:{choices.A}</li> | |
<li>選択肢B:{choices.B}</li> | |
<li>選択肢C:{choices.C}</li> | |
<li>選択肢D:{choices.D}</li> | |
</ul> | |
<h2>正解: {answer}</h2> | |
</div> | |
); | |
} | |
export default SampleQuestion; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment