Skip to content
  • Unlock Pro
  • Log in with GitHub
Profile
OverviewSolutions
2
Comments
1

Hudaifa

@trafargarlaw50 points

I’m a mysterious individual who has yet to fill out my bio. One thing’s for certain: I love writing front-end code!

Latest solutions

  • Space tourism website integration

    #react#vite#tailwind-css

    Hudaifa•50
    Submitted about 3 years ago

    0 comments
  • sunnyside agency landing page main

    #vite#sass/scss

    Hudaifa•50
    Submitted over 3 years ago

    1 comment

Latest comments

  • Emil•60
    @ejoseph89
    Submitted over 3 years ago

    Responsive landing page using React

    #react#sass/scss
    1
    Hudaifa•50
    @trafargarlaw
    Posted over 3 years ago

    Hey, for closing the menu when you click or tap outside of it, since you're using react you could make a custom hook "useClickOutside" for example that takes a ref object of the menu and a handler as parameters it would look something like this : export const useClickOutside = ( ref: React.RefObject<HTMLElement>, handler: () => void ) => { useEffect(() => { const listener = (event: MouseEvent) => { if (!ref.current || ref.current.contains(event.target as Node)) { return } handler() } document.addEventListener('mousedown', listener) return () => { document.removeEventListener('mousedown', listener) } }, [ref, handler]) }

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub