piral-samples/piral-react-router-v6

the v6shim does not work

Closed this issue · 2 comments

I think this might be doomed to failure. If you use gitpod, you can see it failing right away.

You will end up doing a whole lot of monkey patching.

WARNING in ./src/routerV6.tsx 7:0-22
export 'useHistory' (imported as 'ReactRouter') was not found in 'react-router' (possible exports: MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes)
 @ ./src/index.tsx 4:0-49 34:14-20 35:19-30

WARNING in ./node_modules/piral-core/esm/components/DefaultRouteSwitch.js 6:32-38
export 'Switch' (imported as 'Switch') was not found in 'react-router' (possible exports: MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes)
 @ ./node_modules/piral-core/esm/components/index.js 6:0-37 6:0-37
 @ ./node_modules/piral-core/esm/index.js 4:0-29 4:0-29
 @ ./src/index.tsx 3:0-51 30:15-29 54:41-46

WARNING in ./node_modules/piral-core/esm/components/PiralView.js 14:31-43
export 'StaticRouter' (imported as 'StaticRouter') was not found in 'react-router' (possible exports: MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes)
 @ ./node_modules/piral-core/esm/components/index.js 11:0-28 11:0-28
 @ ./node_modules/piral-core/esm/index.js 4:0-29 4:0-29
 @ ./src/index.tsx 3:0-51 30:15-29 54:41-46

WARNING in ./node_modules/piral-core/esm/components/SetRedirect.js 9:61-69
export 'Redirect' (imported as 'Redirect') was not found in 'react-router' (possible exports: MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes)
 @ ./node_modules/piral-core/esm/components/index.js 19:0-30 19:0-30
 @ ./node_modules/piral-core/esm/index.js 4:0-29 4:0-29
 @ ./src/index.tsx 3:0-51 30:15-29 54:41-46

WARNING in ./node_modules/piral-core/esm/components/wrapComponent.js 16:40-55
export '__RouterContext' (imported as '__RouterContext') was not found in 'react-router' (possible exports: MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes)
 @ ./node_modules/piral-core/esm/components/index.js 22:0-32 22:0-32
 @ ./node_modules/piral-core/esm/index.js 4:0-29 4:0-29
 @ ./src/index.tsx 3:0-51 30:15-29 54:41-46

You might want to pull this example.

I think it is a pity that the react-router version is that crucial. Maybe you could have a common interface with react-router-v6 and v5 adapters?

Please have a look at the README. The warnings have been mentioned there.

The code you are referencing here is not used.

(Please next time before spending the time on opening an issue - read the README first: https://github.com/piral-samples/piral-react-router-v6#more-information)