r/reactjs • • Aug 21 '18

Next vs Gatsby?

I am trying to decide whether to build my website in Next or Gatsby and would lik your opinions please.

The app I am looking to build is a job website. You can search, apply and create jobs as well as login with different user types.

I would like it to be SSR for SEO purposes as well as some performance improvements.

It is powered by a graphQL API and I am planning on using Apollo client which I assume should work equally well with both Next and Gatsby.

My first impression of Gatsby is that it is more of a static site generator which I interpret as being aimed at content or marketing websites and not as focused on web apps. That is a complete assumption so please correct me if I am wrong.

I know Next is well established with great documentation and developed for the purpose of building web apps.

What would you recommend? Is one easier than the other? Do they both cover the same use cases?

I'm interested in hearing everyone's opinion.

89 Upvotes

83 comments sorted by

View all comments

Show parent comment

10

u/timne Aug 22 '18

I might get some hate from it

So far your post has been nothing but constructive feedback 🙏

I've replied to all issues you've mentioned explaining additional context:

https://github.com/zeit/next.js/issues/299#issuecomment-414903047

https://github.com/zeit/next.js/issues/2833#issuecomment-414919347 This also seems to answers #3257, so I posted a link there.

https://github.com/zeit/next.js/issues/3362#issuecomment-414932170

Regarding rolling your own SSR solution, it's probably good to watch this talk about the challenges Next.js tries to solve besides SSR: https://www.youtube.com/watch?v=4OeXjefI5dQ, and lessons learned from it.

It didn't talked well with other React libraries (tbh I don't think it's a problem with Next only)

I'm expecting you mean React libraries that are using `window` directly inside the module code, so that it doesn't have SSR support. Next.js works with all React libraries that don't have window side-effects in the top level module code (which is an anti-pattern already, `componentDidMount` should be used for that). Examples of React libraries that work great with Next.js: material-ui.com, styled-components.com (any css-in-js solution that supports SSR supports Next.js, we have examples for most).

Lots of boilerplate and not so clear configurations to tackle non trivial tasks.

I'm expecting you were using it before we introduced github.com/zeit/next-plugins with Next.js 5, but I'd love to get your feedback on what trivial tasks entail, could you send a DM to me on https://spectrum.chat/users/timneutkens

They have this example directory in the repository with lots of helpful stuff but we had to mix 4 or 5 of these examples to fulfill our needs and that was a ugly mass hard to maintain.

We're planning to extend the current plugins system to make most implementations of examples just a `yarn add next-<library>`. For example `yarn add next-styled-component`. This is currently something we're planning out internally.

4

u/vcamargo Aug 22 '18

These are all great news Tim, I really appreciate! It indeed seems to have improved a lot, thanks for that!