28 lines
490 B
React
28 lines
490 B
React
|
// @flow
|
||
|
import * as React from 'react';
|
||
|
|
||
|
type Props = {
|
||
|
children: React.Node,
|
||
|
onSubmit: any => any,
|
||
|
};
|
||
|
|
||
|
export class Form extends React.PureComponent<Props> {
|
||
|
render() {
|
||
|
const { children, onSubmit, ...otherProps } = this.props;
|
||
|
return (
|
||
|
<form
|
||
|
className="form"
|
||
|
onSubmit={event => {
|
||
|
event.preventDefault();
|
||
|
onSubmit(event);
|
||
|
}}
|
||
|
{...otherProps}
|
||
|
>
|
||
|
{children}
|
||
|
</form>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default Form;
|