Get form data using ref attribute on form tag. This could be useful in some cases. The error that I was tackling before I found this solution: "Uncaught TypeError: Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.".
Source code viewer
import React from 'react'; import ReactDOM from 'react-dom'; import {Container, Form} from 'semantic-ui-react'; class MyComponent extends React.PureComponent { constructor(props) { super(props); this.form = React.createRef(); } handleValidate(event) { event.preventDefault(); // Get form data using ref attribute on form tag. const formData = new FormData(ReactDOM.findDOMNode(this.form.current)); } render() { return <> <Container> <Form ref={this.form}> <Form.Button type="submit" onClick={e => this.handleValidate(e)> Validate </Form.Button> </Form> </Container> </>; } }Programming Language: ECMAScript