score:4
you have syntax errors (remove ,
after render, and as your are using es2015 class you can not use key: value
syntax, instead use handleclick(e) {}
), change your code like this
class app extends react.component {
render () {
return <div onclick={this.handleclick}>hedlo</div>
}
handleclick(e) {
alert('--')
}
}
Source: stackoverflow.com
Related Query
- Why does my click event not fire using react js
- React Material-UI checkbox onChange event does not fire
- Change html attribute value does not have data with onclick event using react
- I am using react hooks on menu item. My first click does not do anything, subsequent clicks work as intended
- React - beforeunload event on window does not fire
- Why does the component is not re-rendering when i add @action decorator to an react event handler function
- why blur event not fire in react on textarea?
- Why does React not allow you to bind an event to a function?
- Why does a React JSX element event handler not use parentheses similar to a html event handler?
- React HTML button created in function does not register click event
- Why does the setTimeOut not being cleared by using clean up function in React (useEffect)?
- Why does iFrame in React not respond to click events
- The React synthetic event onAnimationStart does not appear to fire correctly and does not pass an event
- Why does my React app menu open when I am only changing the state and am not using any CSS?
- why my react js button click event not working
- Why does my last todo left do not get delete on first click in react redux
- Why does my simple React form using hooks not work?
- Filled input does not fire onchange event in REACT
- Why my state does not change on click event with setState
- React Material Table action OnClick event for edit and delete does not fire action
- why click event is not working in react js?
- Why is my react on click event not firing a function call?
- Why does using React Context with Framer Motion not work?
- Why does it complain about type {intrinsicattributes && true} or type {intrinsicattributes && false} are not assignable using react and typescript?
- Why does my state not change or work the first time I click submit in React
- Why does my YouTube React component fire the PlayerState.ENDED event twice before playing the next video?
- Why does my React component not render when using React-Router?
- React onClick event does not fire setState
- 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 my React App does not fire up in browser automatically?
More Query from same tag
- Conditionally set background color in React component with Tailwind CSS
- Why does my React App have a syntax error for index.pack.js?
- TypeScript Property 'selected' does not exist on type '{ id: string; value: string; label: string; color: string; }'.ts(2339)
- Showing error in yarn start command says This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
- How to call by the id of array in another component of React
- Styled-components get props value to javascript variable
- React hooks updating component after value inside object inside another object changes - how to?
- GraphQL mutation: Invariant Violation: Must contain a query definition
- Remove inner padding border in Material UI Outlined Text Field
- Updating Child Component Via Change of Props from Parent in React
- Reactjs: Is there a way to center a picture?
- Callback doesn't receive the updated version of state even when it fires well after state changes
- Rendering Ant Design icons from an array
- Cannot find image picker component with 'paste image url' field\tab
- Close menu onClick in React
- "Options" of column chart not getting applied in react .Also I need to set width and height to 100% of div
- React/Redux bundle.js is too big
- DraftJs: Replace an entity using its entity key
- How to solve "Element type is invalid" for my React app?
- Animation is not applied when hovering sidebar
- Adding data to an existing array of objects through an onChange handler
- Infinite loop with a custom hook with UseEffect
- Global JS variable to pass HTML chunk to React component
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type React Typescript
- Only allow specific components as children in React and Typescript
- Flowtype: Refining arrays
- Full screen transition animation in react
- React Conditional Rendering using switch
- Ionic React Swiper not showing number of slides in slidesPerView property
- How to use PaperJs with React?