diff --git a/examples/with-reasonml/bindings/Next.re b/examples/with-reasonml/bindings/Next.re new file mode 100644 index 00000000..ac0ba005 --- /dev/null +++ b/examples/with-reasonml/bindings/Next.re @@ -0,0 +1,37 @@ +module Link = { + [@bs.module "next/link"] external link: ReasonReact.reactClass = "default"; + let make = + ( + ~href=?, + ~_as=?, + ~prefetch: option(bool)=?, + ~replace: option(bool)=?, + ~shallow: option(bool)=?, + ~passHref: option(bool)=?, + children, + ) => + ReasonReact.wrapJsForReason( + ~reactClass=link, + ~props= + Js.Undefined.{ + "href": fromOption(href), + "as": fromOption(_as), + "prefetch": fromOption(prefetch), + "replace": fromOption(replace), + "shallow": fromOption(shallow), + "passHref": fromOption(passHref), + }, + children, + ); +}; + +module Head = { + [@bs.module "next/head"] external head: ReasonReact.reactClass = "default"; + let make = children => ReasonReact.wrapJsForReason(~reactClass=head, ~props=Js.Obj.empty(), children); +}; + +module Error = { + [@bs.module "next/error"] external error: ReasonReact.reactClass = "default"; + let make = (~statusCode: int, children) => + ReasonReact.wrapJsForReason(~reactClass=error, ~props={"statusCode": statusCode}, children); +}; diff --git a/examples/with-reasonml/bsconfig.json b/examples/with-reasonml/bsconfig.json index 66af7686..b1a09958 100644 --- a/examples/with-reasonml/bsconfig.json +++ b/examples/with-reasonml/bsconfig.json @@ -1,7 +1,7 @@ { "name": "with-reasonml", - "sources": ["components", "pages"], - "bs-dependencies": ["reason-react", "bs-next"], + "sources": ["components", "pages", "bindings"], + "bs-dependencies": ["reason-react"], "reason": { "react-jsx": 2 }, "package-specs": { "module": "commonjs", diff --git a/examples/with-reasonml/components/Counter.re b/examples/with-reasonml/components/Counter.re index aa925a1c..ce567c92 100644 --- a/examples/with-reasonml/components/Counter.re +++ b/examples/with-reasonml/components/Counter.re @@ -13,10 +13,10 @@ let make = (_children) => { render: (self) => { let countMsg = "Count: " ++ string_of_int(self.state);
(ReasonReact.stringToElement(countMsg))
-(ReasonReact.stringToElement("This is the about page."))
+(ReasonReact.string("This is the about page."))
(ReasonReact.stringToElement("HOME PAGE is here!"))
+(ReasonReact.string("HOME PAGE is here!"))