1

I am getting an error

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports

I have both CustomButton and InputLabel classes

import React, {Component} from 'react';
import { anycomps... } from 'react-native';
export default class CustomButton extends Component{}

and

import React, {Component} from 'react';
import { anycomps... } from 'react-native';
export default class InputLabel extends Component{}

and in my index.js

import CustomButton from './CustomButton';
import InputLabel from './InputLabel';

export { CustomButton, InputLabel };

and in my app.js

import React, {Component} from 'react';
import { anycomps... } from 'react-native';
import { CustomButton, InputLabel } from './components';

export default class MyMain extends Component{
   ... code renders here
}

my folder structure is:

> components
   >CustomButton.js
   >InputLabel.js
   >index.js
> app.js

What did I miss or do wrong?

I tried it this way Vue Apps and it worked. Is react native having different implementation for this?

Reyn
  • 77
  • 10

0 Answers0