import type { BrowserHistory , Update } from "history" ; import { createBrowserHistory } from "history" ; import type { ReactElement } from "react" ; import * as React from "react" ; import { RemixEntry } from "./components" ; import type { EntryContext } from "./entry" ; import type { RouteModules } from "./routeModules" ; declare global { var __remixContext ; var __remixRouteModules ; var __remixManifest ; } export interface RemixBrowserProps { } /**
 * The entry point for a Remix app when it is rendered in the browser (in
 * `app/entry.client.js`). This component is used by React to hydrate the HTML
 * that was received from the server.
 */ export function RemixBrowser ( _props ) { let historyRef = React . useRef < BrowserHistory > ( ) ; if ( historyRef . current == null ) { historyRef . current = createBrowserHistory ( { window } ) ; } let history = historyRef . current ; let [ state , dispatch ] = React . useReducer ( ( _ , update ) => update , { action : history . action , location : history . location } ) ; React . useLayoutEffect ( ( ) => history . listen ( dispatch ) , [ history ] ) ; let entryContext = window . __remixContext ; entryContext . manifest = window . __remixManifest ; entryContext . routeModules = window . __remixRouteModules ; entryContext . appState . trackBoundaries = false ; entryContext . appState . trackCatchBoundaries = false ; return ( < RemixEntry context = { entryContext } action = { state . action } location = { state . location } navigator = { history } / > ) ; }