PHP Classes

File: client/src/features/components/Routes/BrowserRouter.tsx

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   client/src/features/components/Routes/BrowserRouter.tsx   Download  
File: client/src/features/components/Routes/BrowserRouter.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Wallet API and Application
Application to manage a wallet by calling an API
Author: By
Last change:
Date: 2 years ago
Size: 704 bytes
 

Contents

Class file image Download
import React from "react"; import { History } from "history"; import { BrowserRouterProps as NativeBrowserRouterProps, Router } from "react-router-dom"; export interface BrowserRouterProps extends Omit<NativeBrowserRouterProps, "window"> { history: History; } export const BrowserRouter: React.FC<BrowserRouterProps> = React.memo(props => { const { history, ...restProps } = props; const [state, setState] = React.useState({ action: history.action, location: history.location, }); React.useLayoutEffect(() => history.listen(setState), [history]); return <Router {...restProps} location={state.location} navigationType={state.action} navigator={history} />; });