score:1
i'm unable to reproduce this – works just fine in this minimal example derived from your code.
class myclass extends react.purecomponent {
handlesubmit = () => {
alert('submitted!');
};
render() {
return (
<form onsubmit={this.handlesubmit}>
<button type='submit'>submit</button>
</form>
);
}
}
reactdom.render(<myclass />, document.getelementbyid("root"));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.0/umd/react-dom.production.min.js"></script>
<div id="root" />
Source: stackoverflow.com
Related Query
- React form onSubmit and onClick do not fire when inside Zurb Foundation "Reveal" dialog
- Bootstrap form onSubmit and onClick is not firing the expected function. Button works when outside form component
- React form not submitting when using button nested inside Link tag
- React onClick event to only fire for the clicked div and not the other once
- React Material Table action OnClick event for edit and delete does not fire action
- React form refreshes the entire page onSubmit and setState not working
- e.preventDefault not working when I trigger it from Submit button but working when triggered from onSubmit attribute in Form tag in React
- React prevent form submission when enter is pressed inside input
- React - how to capture only parent's onClick event and not children
- You should not use Route or withRouter() outside a Router when using react-router 4 and styled-component in react
- React Form Component onSubmit Handler Not Working
- UI not re-rendering on state update using React Hooks and form submission
- React native buttons OnPress does not fire when app running in debug mode
- React Ref Form onSubmit Handler not triggered
- React JS : history.push is not a function error and it isn't navigating to a different page onclick of swal
- Why is this not scoped in React form onSubmit function?
- _this.store.getState is not a function when testing react component with enzyme and mocha
- Why is my React checkbox onChange handler firing on render and then not when the box is clicked?
- React onClick event not firing when function is passed to child
- span does not firing OnClick inside list react child component
- Formik React with 2 buttons (Submit and Save) to submit form - Save button not to trigger validation
- How to show Error or Validation messages only after form is submitted and not when user is typing in antd?
- React useEffect hook does not fire when prop dependency changes
- React - Ant Design, Form with getFieldDecorator and initialValue not working in single chechbox
- Javascript onClick not firing when assigned inside of array.map
- onClick not working inside the pop up opened via React portals
- React onSubmit handler on a form won't be called if I have a onBlur handler on an input? (Only happens when using Webstorm js debugger)
- Unicode characters not showed when bundling and deploying React app with webpack and babel
- How to fix "TypeError: items.map is not a function" when working with React and APIs?
- useState not rerendering when update function is called inside onClick function
More Query from same tag
- How to import React object: elements via module.exports and render inside component?
- How to update information from an array to firebase?
- how do I make webpack not convert process.env variables to their values during build?
- Testing React useEffect hook while adding eventListeners
- React-router 4 always reloading the browser on history.push
- Uncaught (in promise) TypeError: Cannot read property 'red' of null
- Any method to use single useState()
- Distinct data in array React
- Webpack Hot Module Replacement still requires full refresh even after setting up
- I try to use const useStyles in class component
- Focused elements display wrong style
- How to bind components to component after using forwardRef?
- How to force SonarLint to scan jsx files?
- Getting value of input causing flickering in React
- Cancel File Upload Post request using Axios
- Axios promise will never resolve
- Reactjs, is setState needed here, changing value of an object in state
- how to make a dispatch wait for the first dispatch to run
- JavaScript: How to map object with nested arrays to table for React
- React - How to check if JWT is valid before sending a post request?
- Remove the inner object reference
- Unsplash API triggering download
- printing filtered data getting different result
- React Hooks selecting data to a date picker
- How to conditional render a class in .map with react/typescript
- Trying to display a random joke, but the question and answers don't match from my local json file
- componentWillReceiveProps in Vue
- How to map an object
- Styling a text in react based on multiple conditions
- Issue using multiple styles with Material-ui and Radium