Check out example codes for "sub menu disappears on hover css". It will help you in understanding the concepts better.

Code Example 1

/* Ensure you use padding instead of margin, the space in between will be filled in */
padding-bottom: 5px;
margin-bottom: 0;

Learn ReactJs, React Native from akashmittal.com