styfle/react-server-example-tsx

Is it possible to add client side routing?

arealmaas opened this issue · 2 comments

My purpose of using this was to render the intial page from the server, but let the client take over routing after the first page has loaded. Is this possible using this scaffold?

Tried using react-router together with this, but since everything is render on the server side first, the BrowserRouter cannot create a DOM history. Any pointers?

nvm, fixed!

Hi @AlmaasAre thanks for asking!

I tried to avoid being too opinionated for the sake of the reader/learner who is reviewing the code. Noticed the only run-time dependencies are react and react-dom. The other devDependencies are simply build tools.

Using react-router is probably the most common way to do routing with react but I left that as an exercise for the reader.

Can you add link to your solution? 😄