Home » Android » redux-form Element type is invalid

redux-form Element type is invalid

Posted by: admin November 1, 2017 Leave a comment

Questions:

“Element type is invalid” I still keep getting this error and don’t know what to do. Tried <form> and <Form> still same. Please help:
This is my AzForm.js saved at: “./components/testComponent”

import React from 'react'
import { Provider } from 'react-redux'
import { Container, Content, Text, Form } from 'native-base';
//import { createStore } from 'redux'  //NOT sure whether I need it, but I still get the same error
import { reduxForm } from 'redux-form'

const SignInForm = props => {
    return (
      <Form>
      </Form>
    );
};

export default reduxForm({
  form: 'simple' // a unique identifier for this form
})(SignInForm)
Answers:

Change

export class HomeScreen

to

export default class HomeScreen`

When you export without the default, the component that is exported becomes what is known as a named export (you can have many of these per file). You would import these as import {HomeScreen} from 'HomeScreen'

The React convention is to one component per file. This is achieved by using the export default option as provided above. You would then import it using import HomeScreen from 'HomeScreen';

Questions:
Answers:

you have export default component… So there is no need to use curly braces during import

import SignInForm from "./components/AzForm";