2016-11-17 85 views
1

跟踪此问题的问题无法解决我的问题。Uncaught TypeError:超级表达式必须为null或函数,而不是未定义(...)

reactjs giving error Uncaught TypeError: Super expression must either be null or a function, not undefined

我反应过来的版本是 “^ 15.3.1”。

我已经加入下面

import React from 'react'; 
import { ButtonInput } from 'react-bootstrap'; 
import {Form,ValidatedInput} from 'react-bootstrap-validation'; 

class myComponent extends React.Component { 
    constructor(props) { 
    super(props); 
    this.handleValidSubmit = this.handleValidSubmit.bind(this); 
    this.handleInvalidSubmit = this.handleInvalidSubmit.bind(this); 

    } 
    handleValidSubmit(values){ 

    } 
    handleInvalidSubmit(errors,values){ 

    } 
    render() { 
    return (
     <Form onValidSubmit={this.handleValidSubmit} 
       onInvalidSubmit={this.handleInvalidSubmit}> 

       <ValidatedInput 
        type='text' 
        label='Email' 
        name='email' 
        validate='required,isEmail' 
        errorHelp={{ 
         required: 'Please enter your email', 
         isEmail: 'Email is invalid' 
        }} 
       /> 

       <ValidatedInput 
        type='password' 
        name='password' 
        label='Password' 
        validate='required,isLength:6:60' 
        errorHelp={{ 
         required: 'Please specify a password', 
         isLength: 'Password must be at least 6 characters' 
        }} 
       /> 

       <ValidatedInput 
        type='password' 
        name='password-confirm' 
        label='Confirm Password' 
        validate={(val, context) => val === context.password} 
        errorHelp='Passwords do not match' 
       /> 


       <ValidatedInput 
        type='checkbox' 
        name='agree' 
        label='I agree to the terms and conditions' 
        validate='isChecked' 
       /> 

       <ButtonInput 
        type='submit' 
        bsSize='large' 
        bsStyle='primary' 
        value='Register' 
       /> 

      </Form> 
    ); 
    } 
} 

module.exports = myComponent; 
+0

没有“Form”组件导入 – degr

+0

import'Form,ValidatedInput} from'react-bootstrap-validation'; – Akshay

+0

对不起,我现在看到。尝试在类声明之前执行诸如console.log(ButtonInput)之类的操作。看起来你的导入路径不正确。 – degr

回答

0

的代码片段好像有一个与react-bootstrap版本> = 0.30冲突。

降级您的react-boostrap版本以兼容react-bootstrap-validation可能有效。

官方问题帖子是here。在作者发布更新来解决这个兼容性问题之前,即使它不是最佳的“解决方案”,也可能需要降级react-bootstrap版本。

相关问题