React: what is the better approach to make a dropdown sidebar?

am building a webapp in react similar to youtube. On the left I have a named list with favorited videos (they are clickable, etc). Would like to show the chosen videos only after the name of a list is clicked. What is the best approach to achive this?

I have seen on the internet, that one can do it with html, css and jacascript, like:

but I also found an example with pure css:

and am confused now.

Please, give me some advice

Making it in React would have not too much difference from just plain HTML/CSS/JS

The only difference is that you could in theory make it a “general” dropdown component so it will work regardless where you place it.

There are tons of React UI library, you can have a look at their source code for inspiration, or just make it your way and be ready to edit it later on if your needs change.

Hope this helps :slight_smile:

Thanks, but after your answer I still do not know, which approach is better, pure css or mix it up with reactjs? :slightly_smiling_face:

Unfortunately for this kind of situation there’s no “better”, it depends on a lot of factors.

My two cents, stick to whatever you feel like it’s the approach that works best for you.