Minimal example showing how shadow-cljs could be used together with Remix to create SSR website in CLJS.
Inspired by https://github.com/thheller/next-cljs.
Sneak-peak:
;; Remix loader
(defn page-index-loader
{:export true}
[]
(js/Promise.resolve #js {:hello "world"}))
;; Remix route component
(defn page-index
{:export true
:remix/page "index"
:remix/loader page-index-loader}
[]
(r/as-element
(let [data (useLoaderData)]
[:div
[:h1 "Hello from Remix"]
[:p "loader data:"
[:pre (js/JSON.stringify data nil 2)]]
[:> NavLink {:to "/about"} "About page"]])))
Note: remix
is a directory used by Remix
, all .js
files will be generated by shadow-cljs, except for entries & root.tsx
.
npm install
npx shadow-cljs watch remix
# or
npx shadow-cljs release remix
cd remix
npm install
npm run dev
open http://localhost:3000