Reputation: 567
I recently built a React site using the static site generator Gatsby.JS and was wondering if there was an easy way for me to convert it to a dynamic site? I'm not sure what's best, extract the Gatsby, deploy as dynamic?
Upvotes: 0
Views: 311
Reputation: 12625
You can continue to use Gatsby and still make the site dynamic. It depends what you mean by "dynamic" exactly.
When a user visits your site, Gatsby will boot React as normal. So if you want to fetch some data, show the user something special if they have already logged in, etc, this is all possible.
There are some special rules to consider with Gatsby. Make sure that the first version of your page is the same as what Gatsby sees. So you can add logic into onComponentDidMount
to change the UI only after React has loaded.
Otherwise, if you want to simply remove Gatsby altogether, you take your existing React components and move them all to a new project. I'd recommend starting with a blank create-react-app
project and copying the components over. The refactoring required should be minimal.
Upvotes: 2