mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(IonRouteInner): migrate to functional component and react router 6
This commit is contained in:
@@ -2,29 +2,8 @@ import type { IonRouteProps } from '@ionic/react';
|
||||
import React from 'react';
|
||||
import { Route } from 'react-router';
|
||||
|
||||
export class IonRouteInner extends React.PureComponent<IonRouteProps> {
|
||||
render() {
|
||||
return (
|
||||
<Route
|
||||
path={this.props.path}
|
||||
exact={this.props.exact}
|
||||
render={this.props.render}
|
||||
{
|
||||
/**
|
||||
* `computedMatch` is a private API in react-router v5 that
|
||||
* has been removed in v6.
|
||||
*
|
||||
* This needs to be removed when we support v6.
|
||||
*
|
||||
* TODO: FW-647
|
||||
*/
|
||||
...((this.props as any).computedMatch !== undefined
|
||||
? {
|
||||
computedMatch: (this.props as any).computedMatch,
|
||||
}
|
||||
: {})
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
export const IonRouteInner = ({ path, render }: IonRouteProps) => {
|
||||
return (
|
||||
<Route path={path} children={render} />
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user