formElement must be a class component to accept a ref

This commit is contained in:
eric-burel 2019-03-15 15:29:58 +01:00
parent 7cfaac2450
commit 339215e6f3

View file

@ -1,7 +1,13 @@
import React from 'react';
import { registerComponent } from 'meteor/vulcan:core';
const FormElement = ({children}) => <form>{children}</form>;
// this component receives a ref, so it must be a class component
class FormElement extends React.Component {
render(){
const { children, ...otherProps } = this.props;
return <form {...otherProps}>{children}</form>;
}
}
registerComponent({
name:'FormElement',
component: FormElement