Dynamic dropdown you can create with help of the map() method of the javascript. Need to create a separate component It helps to create for the repeated anchor then go to header file or where you need this the component then you can call as below code:
Navlist.js
import React from 'react'
import {Link} from 'react-router-dom'
export default (props) => {
const renderSubMenu = () => props.subMenu.map((item, i) =>
return(
<>
- {renderSubMenu()}
</>
)
}
Explore in details
https://www.anythinglearn.com/2019/11/how-to-create-dynamic-dropdown-in-react.html
Top comments (1)
Hi Sheo.
DEV generally asks that folks share their posts in full if possible and there is tooling provided (dev.to/settings/publishing-from-rss) to make it so that it's relatively easy to repost from outside blogs.
And for SEO purpose, you can add
canonical_url
in the frontmatter.Hope you'll consider sharing the full post going forward.