When I click on the div that includes the AnimatedMouse component the event that logged in the console is one of the elements of AnimatedMouse component not the div with className "animated-mouse" itself.
const AnimatedMouseScroll = () => { return ( <div class="scroll-msg-container"> <div class="scroll-msg-inner"> <div class="scroll-msg-wheel"> click here </div> </div> </div> ); } const EmployerService = () => { const scrollToNextSectionHandler = (event) => { console.log("clicked element", event.target) }; return ( <div className="animated-mouse" onClick={(e) => scrollToNextSectionHandler(e)}> <AnimatedMouseScroll /> </div> ); } ReactDOM.render(<EmployerService />, document.getElementById("root")); <div id="root"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.10.2/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.10.2/umd/react-dom.production.min.js"></script>
AnimatedMouse. You've includedAnimatedMouseScroll, but notAnimatedMouse. I've turned your code blocks into a Stack Snippet (the[<>]toolbar button) and changedAnimatedMousetoAnimatedMouseScrolland it seems to show what you're trying to show. For next time, here's how to do one. Runnable examples help you ensure you've included everything necessary, and make it much easier for people to help you.