Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
Is there a way to still show onMouseEnter when trying to navigate to a Sub Menu

I have an application with menu and submenu. The submenu is supposed to display on mouse enter and it should remain on the screen so that i can navigate to the submenu. I am using onMouseEnter and onMouseLeave

import React, {useState} from "react";

export default function ShowButtonHover() {
    const [style, setStyle] = useState({display: 'none'});

    return (
        <div className="App">
            
            <div style={{border: '1px solid gray', width: 300, height: 300, padding: 10, margin: 100}}
                 onMouseEnter={e => {
                     setStyle({display: 'block'});
                 }}
                 onMouseLeave={e => {
                     setStyle({display: 'none'})
                 }}
            >
                <p>Show Sub Menu</p>
            </div>

            <div  style={style}>
                <div><a href='/sub-1'>Sub Menu 1</a></div>
                <div><a href='/sub-2'>Sub Menu 2</a></div>
            </div>
        </div>
    );
}

Is there a way to make the display still remain so i can choose a sub menu and when I leave the main div, It disappears.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!