我是新手,现在我正在尝试一些基本示例。我刚刚创建了一个链接索引页面和一个About页面。然后,我创建了一个自定义App组件,该组件应显示容器中的所有内容,而只显示主页/关于链接的按钮和“ Hello next.js”文本(未显示(“在每个页面上”)。请参见页面布局)。下面
每页***均未显示 主页按钮|关于页面按钮 您好next.js
谁能看到任何错误?我尝试搜索,但仍然看不到我要去哪里
// _app.js
import App, {Container} from 'next/app';
//define the custome App - a class which extends the
default App
class myApp extends App {
return() {
//compent will be the page content
// e.g. index or about
const {Component, pageProps} = this.props;
return (
//container contains page content
<Container>
{/* Content which will be shared */}
<p>On every Page</p>
{/* Component is page e.g. index or about
*/}
<Component {...pageProd}/>
</Container>
);
}
}
export default myApp;
//index.js
import Link from 'next/link'
// Pass this content as 'props' to child components
const Index = props => (
<div>
<Link href="/index">
<button>Home page</button>
</Link>
<Link href="/about">
<button>About page</button>
</Link>
<p>Hello Next.js</p>
</div>
)
export default Index
// about.js
import Link from 'next/link'
// Pass this content as 'props' tp child components
const About = props => (
<div>
<Link href="/">
<button>Home page</button>
</Link>
<Link href="/about">
<button>About page</button>
</Link>
<p>Hello Next.js</p>
</div>
)
export default About
答案 0 :(得分:0)
是。.第一个是return
而不是render
答案 1 :(得分:0)
我遇到了类似的问题,我的问题是缓存,试试这个
rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm run build:tailwind && npm run dev