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

-
} -}; \ No newline at end of file +}; diff --git a/examples/with-reasonml/components/Header.re b/examples/with-reasonml/components/Header.re index 7d02472f..48e94836 100644 --- a/examples/with-reasonml/components/Header.re +++ b/examples/with-reasonml/components/Header.re @@ -7,10 +7,10 @@ let make = (_children) => { render: (_self) =>
- (ReasonReact.stringToElement("Home")) + (ReasonReact.string("Home")) - (ReasonReact.stringToElement("About")) + (ReasonReact.string("About"))
}; diff --git a/examples/with-reasonml/package.json b/examples/with-reasonml/package.json index 4d5b35a9..8e9b8b2e 100644 --- a/examples/with-reasonml/package.json +++ b/examples/with-reasonml/package.json @@ -8,15 +8,14 @@ }, "license": "ISC", "dependencies": { - "babel-plugin-bucklescript": "^0.2.4", + "babel-plugin-bucklescript": "^0.4.0", "next": "latest", - "react": "^16.1.1", - "react-dom": "^16.1.1", - "reason-react": "^0.3.0", - "bs-next": "^2.0.0" + "react": "^16.4.2", + "react-dom": "^16.4.2", + "reason-react": "^0.5.3" }, "devDependencies": { - "bs-platform": "^2.1.0", + "bs-platform": "^4.0.5", "concurrently": "^3.5.1", "webpack": "^3.8.1" } diff --git a/examples/with-reasonml/pages/about.re b/examples/with-reasonml/pages/about.re index f1045656..bc51d811 100644 --- a/examples/with-reasonml/pages/about.re +++ b/examples/with-reasonml/pages/about.re @@ -5,7 +5,7 @@ let make = (_children) => { render: (_self) =>
-

(ReasonReact.stringToElement("This is the about page."))

+

(ReasonReact.string("This is the about page."))

}; diff --git a/examples/with-reasonml/pages/index.re b/examples/with-reasonml/pages/index.re index b6966cd4..b87b0efe 100644 --- a/examples/with-reasonml/pages/index.re +++ b/examples/with-reasonml/pages/index.re @@ -5,7 +5,7 @@ let make = (_children) => { render: (_self) =>
-

(ReasonReact.stringToElement("HOME PAGE is here!"))

+

(ReasonReact.string("HOME PAGE is here!"))

};