So, I'm creating a sidebar that has dropdown menus and I can't figure out how I would create a display page or filler page for my sub menus.
Here's my example data file
const dropdownData = [
{
title: "Data',
path: '/data',
dropdownItems: [
{
title: 'Sub Data',
path: '/data/subdata',
},
{
title: 'Sub Data 2',
path: '/data/subdata2',
},
]
}
So in my App.js I would normally do this for only one page
<Router>
<Sidebar />
<Switch>
<Route path='/data' component={Data} />
</Switch>
</Router>
I then create a pages folder with a Data.js page and just show a filler text like below
import React from 'react';
function Data() {
return (
<div className='data'>
<h1>Data Page</h1>
</div>
);
}
export default Data;
So, if I click on the data menu link, it will just show "Data page"
on the screen.
But what I can't figure out is how would I display a "fake" preview page for the sub menus?
Ideally, a page that says "This is the sub data page"
I've seen examples using :id
but I don't get how to display it visually?
<Route path='/data/:id' component={Data} />
I don't get how this would generate a new page if it's linked to my Data page?
Right now I just link to my path
<Link to={item.path}>
and on the URL it will show data/subdata when I click my sub menu, but I can't figure out how to create the sub menu data page and actually show it visually on my screen?