hey folks. I have this binding:
// ReactRouterDom.re
module Link = {
[@bs.obj]
external makeProps:
(~to_: string, ~children: React.element, ~key: string=?, unit) =>
{
.
"to": string,
"children": React.element,
} =
"";
[@bs.module "react-router-dom"]
external make:
{
.
"to": string,
"children": React.element,
} =>
React.element =
"Link";
[@genType]
let default = make;
};
that i am using here:
module Link = ReactRouterDom.Link;
[@react.component]
let make = () => {
<div>
<h1> {"404 Page Not Found" |> React.string} </h1>
<p> {"Please check the URL and try again" |> React.string} </p>
<Link to_="/home">
{"Click here to return to the homepage" |> React.string}
</Link>
</div>;
};
React.setDisplayName(make, "NotFoundPage");
[@genType]
let default = make;
this compiles.
i am importing the file into js
import NotFoundPage from "./components/NotFoundPage.gen.js";
when i go to some random page i get this error TypeError: Cannot call a class as a function
This is what it looked like in Jsx2
module LinkOld = {
[@bs.module "react-router-dom"]
external linkClass: ReasonReact.reactClass = "Link";
let make =
(
~to_: string,
children,
) => {
/* So far we keep this for Link prop compatibility reasons */
let _dontuse = activeClassName;
let props = {"to": to_};
ReasonReact.wrapJsForReason(~reactClass=linkClass, ~props, children);
};
};
Any ideas? Thank you in advance.