0

我正在尝试验证我的登录表单并使用https://github.com/christianalfoni/formsy-react上的示例

我对反应和形式都很陌生。

我收到错误“未捕获的 ReferenceError:未定义 MyOwnInput”

我的代码看起来像这样

        import Formsy from 'formsy-react';
        import React, { Component } from 'react';
        import {Link} from "react-router";
        import {withRouter} from 'react-router';


       export default withRouter(class Testing extends React.Component{



constructor(props){
    super(props);
    this.state= {
        canSubmit: false
    };
}

enableButton() {
    this.setState({
        canSubmit: true
    });
}
disableButton() {
    this.setState({
        canSubmit: false
    });
}
submit(model) {
    someDep.saveEmail(model.email);
}
render() {
    return (
        <Formsy.Form onValidSubmit={this.submit} onValid={this.enableButton} onInvalid={this.disableButton}>
            <MyOwnInput name="email" validations="isEmail" validationError="This is not a valid email" required/>
            <button type="submit" disabled={this.state.canSubmit}>Submit</button>
        </Formsy.Form>
    );
}
  });
4

1 回答 1

0

MyOwnInput 缺少导入

它会是这样的:

import MyOwnInput from '../../components/common/MyOwnInput';
于 2016-08-22T09:12:46.110 回答