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:
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