[Layout] "treeProps" does not render any nav items
See original GitHub issueI’m currently following the steps at https://react-md.dev/guides/configuring-your-layout.
I have a component which renders the layout:
const MainLayout = (props) => {
const {pathname} = useLocation();
const navItems = {
"/": createRoute("/", "Home", <HomeSVGIcon />),
"/about": createRoute("/about", "About", <HelpSVGIcon/>),
};
return (
<Layout
treeProps={useLayoutNavigation(navItems, window.location.pathname)}
appBarTitle="react-md App"
navHeaderTitle="My App"
title="Title"
>
<App/>
</Layout>
);
};
My createRoute function looks the same like in the documentation:
function createRoute(pathname, children, leftAddon, parentId) {
return {
itemId: pathname,
parentId,
to: pathname,
children,
leftAddon,
};
}
There isn’t rendered anything in the navigation drawer.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
When routing , component is not rendering in Side page
Issue. Your Layout component looks to be designed to render the content as children , but in your App component you don't pass...
Read more >react-md/layout
Renders the navigation tree for the Layout component that adds some reasonable defaults to work with navigation items. Functions. Configuration.
Read more >Tree - Ant Design
Virtual scroll only render items in visible region. Thus not support auto width (like long title with horizontal scroll). What does disabled node...
Read more >Navigation - Starbucks React Pattern Library
If accountNav is provided, the global nav will render distinct submenus in desktop and mobile viewports. This submenu is geared toward the starbucks.com ......
Read more >Navbar - React-Bootstrap
Here's an example of all the sub-components included in a responsive ... While not required, you can wrap the Navbar in a <Container>...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just happened to be great timing that I checked this right as I was stopping work for the day 😃
I’ve updated the docs to hopefully explain this a bit better as well as some outdated notes for adding a transition to the
Layout
component. Just let me know if I should try a different way of documenting this and I’ll reopen this issue.Yeah, it’s the buildTree and useNestedTreeList utils for building a tree list from an object. Since the
useNestedTreeList
defaults to having therootId
set tonull
, we also need the routes to have a defaultrootId
(parentId
) ofnull
to render all the root level tree items/routes.