Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

What is onMouseOverCapture Event in ReactJS ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

React onMouseOverCapture is an event handler that gets triggered whenever the pointer of the mouse is moved on an element or its children. like onMouseOver, but the difference is that onMouseOverCapture acts in the capture phase whereas onMouseOver acts in the bubbling phase i.e. phases of an event.



<element onMouseOverCapture={function}/>

Creating React Application:

Step 1: Create a react project folder, for that open the terminal, and write the command npm create-react-app folder name. Suppose you have already installed create-react-app globally. If you haven’t, install create-react-app globally using the command npm -g create-react-app or install locally by npm i create-react-app.

npm create-react-app project

Step 2: After creating your project folder(i.e. project), move to it by using the following command.

cd project

Project Structure: It will look like this:


Example: In this example, we are adding a text within the <p> tag i.e. ” Move your mouse on this line!”. The onMouseOverCapture event will call onMouseOverCaptureHandler, a function that will show a text “onMouseOverCapture Event!” whenever we move the pointer of the mouse over the element, in the console.


function App() {
  const onMouseOverCaptureHandler = () => {
    console.log("onMouseOverCapture Event!");
  return (
    <div className="App">
      <h1> Hey Geek!</h1>
      <p onMouseOverCapture={onMouseOverCaptureHandler}>
        Move your mouse on this line!
export default App;

Step to Run the Application: Run the application using the following command from the root directory of the project.

npm start



My Personal Notes arrow_drop_up
Last Updated : 29 May, 2022
Like Article
Save Article
Similar Reads
Related Tutorials