Home > other >  i want to create dynamic sidebar in mern stack which render another component when they clicked
i want to create dynamic sidebar in mern stack which render another component when they clicked

Time:11-17

for your understanding i attached w3school screenshot. enter image description here

if u have ever visited w3school website u will understand my requirement easily. i want to create these html sidebar dynamic from my admin dashboard. first i will create one sidebar title name then insert content according to title name and so on..... for best understanding you can assume that i want to create w3school clone dynamic from where i can dynamic create sidebar and content. i read about react router dom and many more but not able to create like this.

CodePudding user response:

You can use react-router for navigation and then render according to the route https://codesandbox.io/s/c2zs4 here is the example I found, it used react-router for navigation and render components according to the route.

CodePudding user response:

add in _app.js file

you can put a header here

<div className="flex">

<div className="W-2/6>
 <Sidebar/>
</div>
<div className="w-4/6">
page component here
</div>
</div>

and footer here

I used tailwind CSS

  • Related