Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.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 多个动态管段同时调用两个元件_Reactjs_Typescript_Next.js - Fatal编程技术网

Reactjs 多个动态管段同时调用两个元件

Reactjs 多个动态管段同时调用两个元件,reactjs,typescript,next.js,Reactjs,Typescript,Next.js,我被困在使用多个动态路线。以下是我的文件夹结构: --[category] index.tsx --[subcategory] index.tsx --[post] index.tsx 我为每个组件放置了console.log - "category" - "subcategory" - "post" 当我访问/[category]时。我得到的日志如下: category subcate

我被困在使用多个动态路线。以下是我的文件夹结构:

--[category]
     index.tsx
  --[subcategory]
     index.tsx
    --[post]
       index.tsx
我为每个组件放置了console.log

- "category"
- "subcategory"
- "post"
当我访问/[category]时。我得到的日志如下:

category
subcategory
这意味着[category]和[subcategory]同时运行 当我调用/[category]/[subcategory]时,只运行[subcategory]。 谁能解释一下原因吗?非常感谢

  • 反应16.8.9
  • 下一篇9.5.2