在开发Next.JS项目(托管在Heroku上)时,我发现了一些像这样的错误:
Promise rejected after context unloaded:Actor 'Conduits' destroyed before query 'RuntimeMessage' was resolved
.....
错误:Minified React错误错误#423;...#482;
访问https://reactjs.org/docs/error-decoder.html?invariant=423获取完整的消息,或者使用非缩小的开发环境获取完整的错误和其他有用的警告。
当访问指定的网站时,我看到:
我们强烈建议您在调试应用时在本地使用开发版本,因为它会跟踪其他调试信息,并提供有关应用中潜在问题的有用警告,但如果您在使用生产版本时遇到异常,此页面将重新组合错误的原始文本。
所以我的问题是。
为了遵循给出的建议,我应该做什么?换句话说,在本地使用开发构建的方法是什么?
只是为了让问题更具体一点。下面是我正在处理的代码。在这一点上,我只想让按钮切换显示,但这不起作用。
'use client';
import Link from 'next/link';
import channelsPool from "@/lib/channels";
import React from 'react';
import {useState,useEffect} from 'react';
export default async function DB_ChanList() {
const [listDisplay,setListDisplay] = useState(true);
const theChannels = await channelsPool()
const swapDisplay = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
setListDisplay(!listDisplay)
} /* End of swapDisplay */
return <div>
{listDisplay &&
theChannels.map(item => (
<div key={item as string}>
<button onClick={(e)=>swapDisplay(e)} value={item}>
<b>{item}</b>
</button>
</div>
))
}
{!listDisplay &&
<div>THE:unitID::</div>
}
</div>
} /* End of DB_ChanList */
字符串
1条答案
按热度按时间n3schb8v1#
您使用的是Next.js docs client components cannot be async functions中的Java客户端组件。
您可以使用
next dev
在本地运行您的应用程序,这将在开发中运行您的应用程序,并提供有关错误的更多详细信息。此外,您可以运行
next build
来查看Next.js在构建应用程序时给出的潜在警告。