mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-09 17:57:26 +03:00
Make sure props are not passed to Fragment
This commit is contained in:
parent
5a9640bd57
commit
47dd105cd6
1 changed files with 6 additions and 2 deletions
|
@ -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">
|
||||||
|
|
Loading…
Reference in a new issue