a react component to quiz for learning
npm install --save react-simple-quiz
import { ReactQuiz } from "react-simple-quiz";
//...
function App() {
const quiz = [
{
id : 1,
question: "Which country is not in Asia? ",
answers : [
{text : "Korea", isCorrect : false},
{text : "Japan", isCorrect : false},
{text : "China", isCorrect : false},
{text : "USA", isCorrect : true},
]
},
{
id : 2,
question: " Which country is not in Africa?",
answers : [
{text : "Morocco", isCorrect : false},
{text : "Jamaica", isCorrect : true},
{text : "Libya", isCorrect : false},
{text : "Congo", isCorrect : false},
]
},
{
id : 3,
question: " Which country is not in Europe?",
answers : [
{text : "France", isCorrect : false},
{text : "Germany", isCorrect : false},
{text : "Argentina", isCorrect : true},
{text : "England", isCorrect : false},
]
},
]
return <ReactQuiz quiz={quiz}/>
}
- required
- number
This props means the sequence number of the quiz.
- required
- srting
This is the contents that will be used for question.
- required
- any
This prop sets the answers to the quiz questions.
- required
- any
This is the contents that will be used for the answers of the quiz.
- required
- boolean
Give true for the correct answer and false for the incorrect answer.