最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Nextjs app running fine in dev mode but giving error on build - Stack Overflow

programmeradmin3浏览0评论

My nextjs app is working fine in dev mode but when I am trying to build it for production it gives an error about array.filter that filter is not defined.

const { questions, answers } = useQuiz();
    const correctAnswersCount = answers.filter((answer, index) => answer === questions[index].correct).length; <!--Error Here -->

    return (
        <div className="flex flex-col items-center justify-center bg-gray-100">
            <div className="w-[70vw] mx-auto">
                <h1 className="text-xl font-bold text-center">Quiz Results</h1>
                <DonutChart correctAnswers={correctAnswersCount} totalQuestions={questions.length} />
                </div><div className='flex justify-center mt-40'>
                <Link href="/review">
                    <button className="mt-4 bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
                        Review Answers
                    </button>
                </Link>
            </div>
        </div>
发布评论

评论列表(0)

  1. 暂无评论