diff options
Diffstat (limited to 'bs5/client/ServerOnlyRSC.re')
-rw-r--r-- | bs5/client/ServerOnlyRSC.re | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bs5/client/ServerOnlyRSC.re b/bs5/client/ServerOnlyRSC.re new file mode 100644 index 0000000..017c156 --- /dev/null +++ b/bs5/client/ServerOnlyRSC.re @@ -0,0 +1,15 @@ +let root = + Webapi.Dom.document + |> Webapi.Dom.Document.querySelector("#root") + |> Option.get; + +let root = ReactDOM.Client.createRoot(root); +let headers = + Fetch.HeadersInit.make({"Accept": "application/react.component"}); +let fetch = + Fetch.fetchWithInit( + Router.demoServerOnlyRSC, + Fetch.RequestInit.make(~method=Fetch.Get, ~headers, ()), + ); +let app = ReactServerDOMEsbuild.createFromFetch(fetch); +ReactDOM.Client.render(root, app); |