/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { FirebaseApp } from '@firebase/app'; import { CrashlyticsOptions } from '../public-types'; import React from 'react'; import { RoutesProps } from 'react-router-dom'; export * from '../public-types'; /** * A wrapper around {@link react-router-dom#Routes} that automatically captures errors in route components. * * This component acts as a replacement for `Routes` from `react-router-dom`. It wraps the routes * in an error boundary that captures errors thrown during rendering and reports them to Crashlytics. * The error boundary is reset on navigation (path changes). * * @example * ```tsx * import { useEffect, useState } from "react"; * import { CrashlyticsRoutes } from "@firebase/crashlytics/react-router"; * import { FirebaseApp, initializeApp } from "@firebase/app"; * * export default function MyApp() { * const [app, setApp] = useState(null); * * useEffect(() => { * if (getApps().length === 0) { * const newApp = initializeApp({...}); * setApp(newApp); * } else { * setApp(getApp()); * } * }, []); * * return ( * <> * {app && ( * * } /> * } /> * * )} * ... * * ); * } * ``` * * @param firebaseApp - The {@link @firebase/app#FirebaseApp} instance to use. * @param crashlyticsOptions - {@link CrashlyticsOptions} that configure the Crashlytics instance. * @returns The rendered routes wrapped in an error boundary. * * @public */ export declare function CrashlyticsRoutes({ firebaseApp, crashlyticsOptions, children, ...props }: RoutesProps & { firebaseApp: FirebaseApp; crashlyticsOptions?: CrashlyticsOptions; }): React.ReactElement | null;