/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react/src/components/IonRoute.tsx
33 строки
879 B
Liam DeBeasi
chore(react): migrate to eslint, add prettier (#26633)
19 янв 2023, 00:49
Не верифицирован
19 янв 2023, 00:49
b02190d
Код
Авторство
О чём код?
import React from 'react'; import { NavContext } from '../contexts/NavContext'; export interface IonRouteProps { path?: string; exact?: boolean; show?: boolean; render: (props?: any) => JSX.Element; // TODO(FW-2959): type disableIonPageManagement?: boolean; } // eslint-disable-next-line @typescript-eslint/no-empty-interface interface IonRouteState {} export class IonRoute extends React.PureComponent<IonRouteProps, IonRouteState> { context!: React.ContextType<typeof NavContext>; render() { const IonRouteInner = this.context.getIonRoute(); if (!this.context.hasIonicRouter() || !IonRoute) { console.error('You either do not have an Ionic Router package, or your router does not support using <IonRoute>'); return null; } return <IonRouteInner {...this.props} />; } static get contextType() { return NavContext; } }