reactjs - Element type is invalid: got: undefined -
import * react 'react'; import * reactdom 'react-dom'; import {jumbotron} 'ui-library'; import registerserviceworker './registerserviceworker'; import './index.css'; reactdom.render( <jumbotron />, document.getelementbyid('root') htmlelement ); registerserviceworker();
this index.ts
import * react 'react'; class jumbotron extends react.component<{},{}>{ constructor(props:{},context: {}){ super(props,context) } render(){ return (<h1>hello, world </h1>); } } export default jumbotron
this topheader defined in library
this index.ts of ui-library
export {default jumbotron} './jumbotron'; export {default topheader} './topheader';
i getting following error react
element type invalid: expected string (for built-in components) or class/function (for composite components) got: undefined.
any appreciated.
change ui-library file to:
import jumbotron './jumbotron'; import topheader './topheader'; export { jumbotron } export { topheader }
also looks importing ui-library npm package. verify file path importing correct?
import {jumbotron} 'ui-library';
i expect like:
import {jumbotron} './ui-library';
Comments
Post a Comment