rescript-relay-next-ssr-template
rescript-relay-next-ssr-template copied to clipboard
Rescript + Relay + Next.js + SSR example!
Rescript + Relay + Next.js + SSR example!
- using graphql example by GraphQL-Pokemon
Concept
- Make feature component by using relay fragment (like PokemonDetail.res)
- Write page by rescript. (Warning; rescript file name should be unique by your project) (/pages/pokemon/[pokemonEnum].res)
- In page, make query and connect using feature fragments
- Make environment and execute query and return dehydrate store data at
getServerSideProps(This process is configure by RelayEnv.SSR.make function and hydrateRelayStore.ts) - Execute query at page renderer, pass the
fragmentRefsto feature component - complete!