Expected a string (for built-in components) or a class/function (for composite components) but got: object


#1

Hi all
I have aApp.re file that looks as following:

    let component = ReasonReact.statelessComponent("App");

    let make = ( _children) => {
      ...component, 
      render: _self => <div> 
      <DashboardView /> 
      </div>
    };

    let default =ReasonReact.wrapReasonForJs(
        ~component,
        (_) => make([||])
      );

React complains: 
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `App`.
▶ 30 stack frames were collapsed.
./src/index.js
src/index.js:7
   4 | import App from './App.bs';
   5 | import registerServiceWorker from './registerServiceWorker';
   6 | 
>  7 | ReactDOM.render(<App />, document.getElementById('root'));
   8 | registerServiceWorker();
   9 | 
  10 | 
View compiled

I thought, that error comes from DashboardView component, as you can on the file structure:
Screenshot%20from%202018-04-06%2008-29-32

The content of View.js:

import React from 'react';

const View = () => (
  <div>
    <p>Hello world</p>
  </div>
);

export default View;

and DashboardView.re

[@bs.module] external dashboardView : ReasonReact.reactClass = "./View";

let make = (children) =>
  ReasonReact.wrapJsForReason(
    ~reactClass=dashboardView,
    ~props=Js.Obj.empty(),
    children
  );

What am I doing wrong?

Thanks


#2

Please see https://bucklescript.github.io/docs/en/import-export.html#import-an-es6-default-value