(props: {initialEntries?: string[]; children: ReactNode})
| 21 | }); |
| 22 | |
| 23 | export function MemoryRouter(props: {initialEntries?: string[]; children: ReactNode}) { |
| 24 | let {initialEntries = ['/'], children} = props; |
| 25 | let [location, setLocation] = useState<Location>({pathname: initialEntries[0]}); |
| 26 | let navigate = (pathname: string) => setLocation({pathname}); |
| 27 | |
| 28 | return <RouterContext.Provider value={{location, navigate}}>{children}</RouterContext.Provider>; |
| 29 | } |
| 30 | |
| 31 | export function useLocation(): Location { |
| 32 | return useContext(RouterContext).location; |
nothing calls this directly
no outgoing calls
no test coverage detected