m03a3a17 m03a3a17 - 11 months ago 47
React JSX Question

Uncaught ReferenceError: MyOwnInput is not defined in react.js(formsy react)

I am trying to validate my Login form and using example on https://github.com/christianalfoni/formsy-react

I am new to both react and formsy.

I am getting error as "Uncaught ReferenceError: MyOwnInput is not defined"

my code looks like this

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{

this.state= {
canSubmit: false

enableButton() {
canSubmit: true
disableButton() {
canSubmit: false
submit(model) {
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>

Answer Source

Missing import for MyOwnInput

It will be something like:

import MyOwnInput from '../../components/common/MyOwnInput';