mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-09 01:37:24 +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 routesPrefix = useRoutesPrefix();
|
||||
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();
|
||||
useEffect(() => hideSidebar(), [location]);
|
||||
|
@ -43,7 +47,7 @@ export const Main = (
|
|||
// FIXME Check if this works when not currently wrapped in a router
|
||||
|
||||
return (
|
||||
<Wrapper basename={routesPrefix}>
|
||||
<Wrapper {...props}>
|
||||
<FontAwesomeIcon icon={burgerIcon} className={burgerClasses} onClick={toggleSidebar} />
|
||||
|
||||
<div {...swipeableProps} className="menu-layout__swipeable">
|
||||
|
|
Loading…
Reference in a new issue