我正在开发一个 NEXT JS 项目,但找不到两次渲染应用程序的解决方案!
Problem
添加后rewrites to next.config.js
,App被渲染两次。如果移除,则渲染一次。
next.config.js
async rewrites() {
return [
{
source: '/about',
destination: '/',
},
]
},
_app.js
function MyApp() {
console.log('App render');
return (<></>);
}
export default MyApp
这应该是预期的行为——因为重写会导致 nextjs 中的双重渲染
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)