Skip to content
Advertisement

Create sub-headings in a react dropdown component

I have created a drop down menu using the react component . The code is below:

JavaScript

The person object is as follows:

JavaScript

I was wondering whether it is possible to have sub-headings within this drop down menu in order to group the people (e.g. Men, Women). I have found it possible when using plain javascript but I can’t seem to find how to do it with the set up I currently have.

Advertisement

Answer

I finally managed to achieve it like this:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement