I am developing a Quiz App that consists of two main pages: takeQuiz.js
and result.js
. My goal is to transfer the data from the multiple-choice questions (mcqs) in takeQuiz.js
to be accessible in result.js
. Utilizing router.replace()
, I ensure that once the user submits the quiz, they cannot go back.
takeQuiz.js
mcqsData = [
{quesId:1,correct:'Option A',selectedOption:'Option C'},
{quesId:1,correct:'Option C',selectedOption:'Option B'},
{quesId:1,correct:'Option D',selectedOption:'Option D'},
]
I attempted to access this array in result.js
by using import data from './takeQuiz.js'
, but it resulted in returning undefined
.