Dropdown menu bug

Hi there.

I’m trying to create a dropdown menu component inside a nav bar, and I found out that everything works nice until I turned it into a component. The dropdown menu suddenly not work anymore. Once I detached it, it worked normally again. Is this a bug or did I do anything wrong?

Link: