mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 11:03:50 +00:00
Make sure props are not passed to Fragment
This commit is contained in:
@@ -31,7 +31,11 @@ export const Main = (
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const routesPrefix = useRoutesPrefix();
|
const routesPrefix = useRoutesPrefix();
|
||||||
const inRouterContext = useInRouterContext();
|
const inRouterContext = useInRouterContext();
|
||||||
const Wrapper = useMemo(() => (inRouterContext ? Fragment : BrowserRouter), [inRouterContext]);
|
const [Wrapper, props] = useMemo(() => (
|
||||||
|
inRouterContext
|
||||||
|
? [Fragment, {}]
|
||||||
|
: [BrowserRouter, { basename: routesPrefix }]
|
||||||
|
), [inRouterContext]);
|
||||||
|
|
||||||
const [sidebarVisible, toggleSidebar, showSidebar, hideSidebar] = useToggle();
|
const [sidebarVisible, toggleSidebar, showSidebar, hideSidebar] = useToggle();
|
||||||
useEffect(() => hideSidebar(), [location]);
|
useEffect(() => hideSidebar(), [location]);
|
||||||
@@ -43,7 +47,7 @@ export const Main = (
|
|||||||
// FIXME Check if this works when not currently wrapped in a router
|
// FIXME Check if this works when not currently wrapped in a router
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper basename={routesPrefix}>
|
<Wrapper {...props}>
|
||||||
<FontAwesomeIcon icon={burgerIcon} className={burgerClasses} onClick={toggleSidebar} />
|
<FontAwesomeIcon icon={burgerIcon} className={burgerClasses} onClick={toggleSidebar} />
|
||||||
|
|
||||||
<div {...swipeableProps} className="menu-layout__swipeable">
|
<div {...swipeableProps} className="menu-layout__swipeable">
|
||||||
|
|||||||
Reference in New Issue
Block a user