Problem when rendering view (react-router 1.0) undefined component

1

I can not render the view, my code is like the following example server .

When I run the server:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

{ [Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.] name: 'Invariant Violation', framesToPop: 1 }

And this shows me when I make a log to renderProps :

{ routes: 
   [ { childRoutes: [Object] },
     { path: '/',
       component: [Function: BaseAdmin],
       indexRoute: [Object],
       childRoutes: [Object] },
     { component: [Function: Home] } ],
  params: {},
  location: 
   { pathname: '/',
     search: '',
     hash: '',
     state: null,
     action: 'POP',
     key: 'zljum4',
     query: {},
     '$searchBase': { search: '', searchBase: '' } },
  components: [ undefined, [Function: BaseAdmin], [Function: Home] ],
  history: 
   { listenBefore: [Function: listenBefore],
     listen: [Function: listen],
     transitionTo: [Function: transitionTo],
     push: [Function: push],
     replace: [Function: replace],
     go: [Function: go],
     goBack: [Function: goBack],
     goForward: [Function: goForward],
     createKey: [Function: createKey],
     createPath: [Function: createPath],
     createHref: [Function: createHref],
     createLocation: [Function: createLocation],
     setState: [Function: setState],
     registerTransitionHook: [Function: registerTransitionHook],
     unregisterTransitionHook: [Function: unregisterTransitionHook],
     pushState: [Function: pushState],
     replaceState: [Function: replaceState],
     isActive: [Function: isActive],
     match: [Function: match],
     listenBeforeLeavingRoute: [Function: listenBeforeLeavingRoute] } }
    
asked by soldat25 17.01.2016 в 03:06
source

1 answer

1

Without seeing the component code it will be difficult to help you, but it is most likely that you are not exporting it correctly. If the component is in a separate .js file, make sure you export it correctly:

In ES6 it would be like this:

class MyComponent extends React.Component {
  ...
}
export default MyComponent
    
answered by 09.06.2016 в 13:03