How does Next.js compare to Gatsby?
Gatsby probably isn't the right choice if you have a lot of pages (e.g. ecommerce site) as it has to render each page down to HTML during the build - so everytime you make a change, you have to rebuild all those files which could take a substantial amount of time. But if you were just building a few landing pages or a blog that required good SEO then Gatsby would be fine.
Next.js renders serverside on the fly and has good SEO.
This might be useful for you to read: https://coffeencoding.com/cra-vs-next-js-vs-gatsby/
I like to use next.js for small brochure-like websites. I think it's simpler for simpler things. But for a more full-featured content site I would chose gatsby.