stefan-hoeck / idris2-rhone-js

Experimental JS bindings for idris2-rhone
BSD 3-Clause "New" or "Revised" License
21 stars 5 forks source link

Server side rendering tutorial #63

Open srghma opened 1 month ago

srghma commented 1 month ago

how to accomplish what next.js accomplishes?

if website is requested first time - THEN send html with prerendered content ELSE (if just going to other page using browser) THEN request server /api for more data and render new page on browser side

stefan-hoeck commented 1 month ago

Sorrry, I don't understand the question. What is next.js?

srghma commented 1 month ago

framework that adds SSR to react https://github.com/vercel/next.js/

usually one writes

function MyPage() {
   const data = requestDataFromServerHook()
   return <div>....</div>
}

but with this framework can write

function MyPage(dataFetchedFromApiOnServerSite) {
   return <div>....</div>
}

MyPage.specialFunctionToFetchOnServerSide = ...

can try to make such framework if there is a HTML -> Text printer

stefan-hoeck commented 1 month ago

There is an HTML to String rendering function, but I suggest you have a look at idris2-dom-mvc, which comes without the FRP complexity of idris2-rhone-js.