score:396
Accepted answer
You're probably using the DOM MouseEvent
. Try using React.MouseEvent<HTMLInputElement>
instead.
score:7
You can use SyntheticEvent instead of MouseEvent
score:27
In order to use React MouseEvent just make sure to add:
import { MouseEvent } from 'react';
Source: stackoverflow.com
Related Query
- Why is the `MouseEvent` in the checkbox event handler not generic?
- Why is my React checkbox onChange handler firing on render and then not when the box is clicked?
- Why does the onChange event handler on <form> pick upp dispatched events from <select>, but not <input>?
- Why does the component is not re-rendering when i add @action decorator to an react event handler function
- Why React event handler is not called on dispatchEvent?
- Why is the keyboard (onKeyDown) event bubbling not accessible on the component, but is on the parent?
- Why value from a Material-UI Button is not being passed to the onClick event handler?
- Why does passing event handler to child component not work
- Why does a React JSX element event handler not use parentheses similar to a html event handler?
- Why is the event handler called twice?
- JavaScript click event handler not fired in the code below
- Why do event handlers not get the right handle to this?
- Trying to dispatch an action from the fabric.js event handler causes "Reducers may not dispatch actions."
- Why is space character not being written on the text area when I am firing the keypress event with the correct code?
- Why do I need to define the event handler `handleStatusChange` in `useEffect`?
- generic event handler to set the state of any form field
- Why can an Array not be used in useState where the generic is of the same type as the array
- why click event is not adding qty in the cart
- Why are React props not updated in event handler
- React: Why <Input> puts the event object at the end of the argument of the event handler
- Why the warning: Unknown event handler property `onSession` is displayed in React app?
- Why does checkbox not change the color style of the div element?
- React: Why the onChange event does not trigger?
- Why does my onClick handler not log out the latest version of state and how can I troubleshoot this?
- Why is this handleBlur function with event parameters when the event parameter is not used inside the function?
- React Component event handler function did not received the newest value from Redux Store
- why is a React class component converted to functional component with hooks not picking up state in event handler on document
- Event handler not accessing the correct value from redux state
- Why does React rerender when the state is set to the same value the first time via an onClick event on DOM, but not react-native?
- Why is "this" keyword undefined when invoked by inline event handler in React, but it refers to the caller when invoked by post-render event listener?
More Query from same tag
- Use multiple forms in one project with React Hook Form
- React js Warning: Don't set the props property of the component. Mutate the existing props object instead
- create-react-app with node express getting %PUBLIC_URL%
- How do I get a series of documents from Firestore and return them all in an array?
- React/Typescript - which type to use for router props and how to get query value from it
- Typescript returns error when a function type is FunctionalComponent, but not for arrow function
- react-router v3: how to reload page when entering and leaving a specific route
- Why does making multiple assertions in a single Jest-Enzyme test case yields incorrect test result?
- How do you do conditional hovering in styled components?
- useApi hook with params
- React update list isn't a function
- How to add a div every 3rd map/loop inside map react function
- Redux dispatch function and TypeScript
- How to redirect on button click in ReactJS
- Access String array in Json
- Create a rotated text banner (trapezoid) on top of image in React Native
- Using useContext in a pure Typescript class
- arrow function not working in react function
- styled-components local variable
- Programmatically loop a section of JSX within an output
- e.target.value in button returns undefined sometimes. Why this happens?
- Render JSON data from API call in react
- toggleClass React js
- ReactJS complex (if / else if) not working as expected
- Reset React state before a render
- In React functional Component , test internal functional using jest and enzyme
- Redux-Saga and createAction from Redux-Toolkit does not run
- How to iterate over array by key name and if keys are empty include them in loop js
- ReactJS: TypeError: Cannot read property 'name' of undefined
- ReactJS won't print an array in the order that it is stored?