diff --git a/examples/App.re b/examples/App.re
new file mode 100644
index 0000000..83b1cd4
--- /dev/null
+++ b/examples/App.re
@@ -0,0 +1,80 @@
+module Style = {
+ let global = ReactDOMRe.Style.make(~fontFamily="sans-serif", ());
+
+ let title =
+ ReactDOMRe.Style.make(
+ ~alignItems="flex-start",
+ ~borderBottom="2px solid hotpink",
+ ~display="flex",
+ ~fontSize="18px",
+ ~fontWeight="700",
+ ~margin="6px 12px",
+ ~marginBottom="24px",
+ ~paddingBottom="6px",
+ (),
+ );
+
+ let navigation =
+ ReactDOMRe.Style.make(
+ ~backgroundColor="#f9f9f9",
+ ~borderRight="1px solid #eaeaea",
+ ~bottom="0px",
+ ~display="flex",
+ ~flexDirection="column",
+ ~left="0px",
+ ~listStyleType="none",
+ ~padding="32px 12px",
+ ~position="fixed",
+ ~top="0px",
+ ~width="256px",
+ (),
+ );
+
+ let link = active =>
+ ReactDOMRe.Style.make(
+ ~color="black",
+ ~fontWeight={
+ active ? "700" : "500";
+ },
+ ~margin="6px 12px",
+ ~textDecoration="none",
+ (),
+ );
+};
+
+[@react.component]
+let make = () => {
+ let url = ReasonReactRouter.useUrl();
+
+ let (example, currentUrl) =
+ switch (url.path) {
+ | ["basic"]
+ | [] => (, "basic")
+ | ["lazyload"] => (, "lazyload")
+ | _ => (
+
+ {"Nothing to see here..." |> React.string}
+
,
+ "",
+ )
+ };
+
+ ;
+};
diff --git a/examples/Basic.re b/examples/Basic.re
index 3bdbfcf..6d2d8e9 100644
--- a/examples/Basic.re
+++ b/examples/Basic.re
@@ -1,10 +1,40 @@
+module Style = {
+ let wrapper =
+ ReactDOMRe.Style.make(
+ ~height="150vh",
+ ~display="flex",
+ ~flexDirection="column",
+ ~alignItems="center",
+ ~transition="background-color 1s ease",
+ (),
+ );
+
+ let box = visible =>
+ ReactDOMRe.Style.make(
+ ~alignItems="center",
+ ~backgroundColor={
+ visible ? "hotpink" : "transparent";
+ },
+ ~color="white",
+ ~display="flex",
+ ~fontSize="32px",
+ ~height="256px",
+ ~justifyContent="center",
+ ~marginTop="auto",
+ ~transition="background-color 1s ease",
+ ~width="256px",
+ (),
+ );
+};
+
[@react.component]
let make = () => {
let (isVisible, ref) = ReactIsVisible.useIsVisible();
-
-
+
+
{"Scroll down" |> React.string}
+
{(isVisible ? "I'm visible!" : "I'm not visible!") |> React.string}
-
+
;
};
diff --git a/examples/Index.re b/examples/Index.re
index cb2f435..9429167 100644
--- a/examples/Index.re
+++ b/examples/Index.re
@@ -1 +1 @@
-ReactDOMRe.renderToElementWithId(, "root");
+ReactDOMRe.renderToElementWithId(, "root");
diff --git a/examples/LazyLoad.re b/examples/LazyLoad.re
new file mode 100644
index 0000000..af34650
--- /dev/null
+++ b/examples/LazyLoad.re
@@ -0,0 +1,55 @@
+module Style = {
+ let wrapper =
+ ReactDOMRe.Style.make(
+ ~alignItems="center",
+ ~display="grid",
+ ~fontFamily="sans-serif",
+ ~gridGap="32px",
+ ~justifyContent="center",
+ (),
+ );
+
+ let box =
+ ReactDOMRe.Style.make(
+ ~alignItems="center",
+ ~backgroundColor="hotpink",
+ ~color="white",
+ ~display="flex",
+ ~fontSize="32px",
+ ~height="256px",
+ ~justifyContent="center",
+ (),
+ );
+};
+
+[@react.component]
+let make = () => {
+ let (isVisible, ref) = ReactIsVisible.useIsVisible();
+ let (items, setItems) = React.useState(() => [|0, 0, 0, 0|]);
+
+ React.useEffect1(
+ () => {
+ isVisible
+ ? setItems(currentItems =>
+ currentItems |> Array.append([|0, 0, 0, 0|])
+ )
+ : ();
+
+ None;
+ },
+ [|isVisible|],
+ );
+
+
+ {items
+ |> Array.mapi((i, _item) =>
+
+ {string_of_int(i) |> React.string}
+
+ )
+ |> React.array}
+
+ {"When you see this, more items will load" |> React.string}
+
+
;
+};