Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在NextJS中重新使用父组件的导航_Reactjs_React Router_Next.js - Fatal编程技术网

Reactjs 在NextJS中重新使用父组件的导航

Reactjs 在NextJS中重新使用父组件的导航,reactjs,react-router,next.js,Reactjs,React Router,Next.js,我的nextJS应用程序中有以下结构: pages projects index.tsx [projectId] visualizer index.tsx explorer index.tsx 该应用程序包含: export default function MyApp({ Component, pageProps }: AppProps) { ... return ( <StyledPage>

我的nextJS应用程序中有以下结构:

pages
  projects
    index.tsx
    [projectId]
      visualizer
        index.tsx
      explorer
        index.tsx
该应用程序包含:

export default function MyApp({ Component, pageProps }: AppProps) {
...
  return (
    <StyledPage>
      <Header />
      <StyledWrapper>
        <Component {...pageProps} />
      </StyledWrapper>
    </StyledPage>
  )
}
导出默认函数MyApp({Component,pageProps}:AppProps){
...
返回(
)
}
是全球导航吗 我需要在/projects/.id../a子导航下重新使用/projects/[id]/index.tsx中的导航

因此/visualizer/index.tsx和explorer/index.tsx将从/projects/[id]/index.tsx的选项卡打开

在我使用的顶层(_app.tsx)中,我尝试在/projects/[id]/index.tsx中使用相同的方法,但在那里不起作用

如何通过在nextJS中重新使用父组件的导航来实现子组件

谢谢!:)