首页 > 解决方案 > JHipster with React - 如何创建一个独特的路由文件来管理模块文件夹中的所有组件?

问题描述

当我用一个实体生成一个新应用程序时,我有这个结构:

webapp
├── app                                        
│   └── entities
│       ├── foo                           - CRUD front-end for the Foo entity
│       │   ├── foo-delete-dialog.tsx     - Delete dialog component
│       │   ├── foo-detail.tsx            - Detail page component
│       │   ├── foo-dialog.tsx            - Creation dialog component
│       │   ├── foo.reducer.ts            - Foo entity reducer
│       │   ├── foo.tsx                   - Entity main component
│       │   └── index.tsx                 - Entity main routes
│       └── index.tsx                     - Entities routes

为了使此代码适应我的需要,我将整个文件夹复制并粘贴app/entities/foo到其中,app/modules/foo因为我想在使用生成器操作 foo 实体时避免冲突。我修复了所有导入错误。但是,该app/modules/foo/index.tsx文件的工作方式与app/entities/foo/index.tsx. React-router 不会在路由更改时渲染组件。请问如何在模块文件夹中实现这一点,就像在实体文件夹中一样?

标签: reactjsreact-routerjhipster

解决方案


推荐阅读