Comprehensive guide about Gatsby routing you should know

Client side only with static pages

I assume that you have basically done something with Gatsby before. In this article, we will follow some steps:

  • Create some pages inside pages folder.
  • Create some pages with for client side only with @reach/router.
  • Compare two kind of pages above after run gatsby build and view page source by Ctrl + U.
Example code for two basic pages, left is without using `@reach/router`
Build folder without profile and login pages
I use Ctrl + F to find the text to make sure page is actually be SSR
Profile page has not been SSR

What’s next!

You might be wonder what we should do if we want to make some pages that need to be actually SSR and then, some parts should be rendered on the client side instead of blank page like above?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ShinaBR2

ShinaBR2

Don’t run behind success. Follow behind excellence, success will come all way behind you.