Undefined value received instead of expected string or class/function for built-in/composite components

The index.js file, which contains the error, is provided below, along with the App.js and configureStore.js code. The error message states that “is not part of the API of https://github.com/reactjs/react-router-redux#api”. Based on the available information, it appears that the error is caused by a conditional return statement in a component that lacks a default return for cases where the condition fails.

Question:

I’m not sure where the error is in my code.

Be cautious as the type expected by React.createElement should be a string for built-in components or a class/function for composite components. However, it appears that you have provided %s.%s%s, undefined,
you likely forgot to export your component from the file it’s defined in
, or there could be a possibility of confusion between default and named imports.

app.js

import React, { Component } from 'react';
import {
  Navigator,
} from 'react-native';
import Movies from './Movies';
const RouteMapper = (route, navigator) => {
  if (route.name === 'movies') {
    return ;
  }
};
export default class App extends Component {
  render() {
    return (
       Navigator.SceneConfigs.FloatFromBottom}
        // Pass a route mapper functions
        renderScene={RouteMapper}
      />
    );
  }
}

Movies.js

import React, { Component } from 'react';
import {
  ScrollView,
  Text,
  View
} from 'react-native';
import { movies } from './data';
export default class Movies extends Component {
  render() {
    return (
      
        
          {movies.map((movie, index) => {movie.title})}
        
      
    );
  }
}




Solution:

It’s possible that you didn’t return anything from your jsx or you returned the default value of every function in JavaScript, which is

undefined

.

Based on my assumption, it seems that the issue arises from

RouteMapper

component, as it doesn’t have a default return in case the if condition fails. It is advisable to consider returning

null

as a default return value for this component.

In case this solution is ineffective, trace the
rendered components
and ensure that each of them has a return statement that is not implicit or explicit in

undefined

.

Frequently Asked Questions