ionic-team / ionic-team/ionic-docs

React Routes Switch in Ionic can not route to an IonPage

未关闭
#2,570 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
triage
主要语言
MDX
星标
621
派生
3.2k
平均合并
1 天 2 小时
30 天内合并 PR
86

描述

### URL

https://ionicframework.com/docs/react/navigation#switches-in-ionrouteroutlet

### Issue Description

The `Switch` component can not route to a sub component that is wrapped in `IonPage`.

This is what I think is the reason.
Because `IonPage` is exclusive, there can only be a single `IonPage` in a view. The `Switch` can not route to a component with `IonPage`. As shown by the React Router documentation "basic" example, a custom page component can implement a list of links that uses a `Switch` to route a subview of components below it within the same view. This would result in nested `IonPage` components, and therefore doesn't work.

The `Switch` component is useful only in the case where you want to insert components into a subview that will update the URL and work with the history stack, but in a way that is not tabs.

贡献指南

打开贡献指南

调研方向

Start with the React navigation documentation at the URL in the issue, especially the section on switches in IonRouterOutlet. Determine whether the example or its explanation should address routing to components wrapped in IonPage; done means the documentation accurately explains the supported behavior and limitation.

由索引模型根据 Issue 内容生成。

评估

技术栈
react
领域
documentation
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
32/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。