Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create-React-App vs Next.js #2559

Closed
cr101 opened this issue Jun 18, 2017 · 10 comments
Closed

Create-React-App vs Next.js #2559

cr101 opened this issue Jun 18, 2017 · 10 comments

Comments

@cr101
Copy link
Contributor

cr101 commented Jun 18, 2017

I am a React beginner but working towards building a production-ready app.

  • Should I start investing my time in learning how Next.js works instead or should I continue to use CRA?
  • Will it be hard to implement Analytics tools to track page views, will my app not be as search engine friendly, etc if I build it with CRA instead of NextJS because of CRA's lack of server-side rendering support?
  • Who should use Create React App other than people using it for teaching React?
  • What are the advantages of using CRA over Next.js other than that "it just works"?

Using CRA to learn React and later switching to Next.js makes the process of building a React app even longer and for that reason, it's not a very good option IMO.

Apologies for being off-topic but I'm often confused as to which tool I should invest the time in learning.

@notrab
Copy link

notrab commented Jun 18, 2017

Hey @cr101 I just finished recording a short video on why I think Next.js is cool.

CRA is great for getting going and it has a great foundation for bundling for production but if you care about server side rendering, code splitting and arguably increased performance gains, Next.js could be a great tool for you to use, if you don't want to eject from CRA.

Next.js has a baked in router and makes a lot of decisions for you. You might find you want more control and therefor CRA might be the better tool for the job.

That said, I seen a package yesterday regarding extending CRA without ejecting, so there could be some new things in the community that leverage some of the Next.js ideas here.

Both projects are fast moving but Next.js has a slightly different goal than CRA. You certainly won't lose any sleep regretting learning one over the other, as they both have a great developer experience, you'll load a load from them.

Pick one, have a go and see what you run into. You'll soon know if you should of picked the other.

@viankakrisna
Copy link
Contributor

viankakrisna commented Jun 18, 2017

next is a good start if you need SSR first, SEO friendly with lots of public content. But if you build a highly dynamic statically deployed Single Page Application client, CRA is better suited for that.

So for blog, news, with lots of public content and shareability, I'll go with next.
For dashboard, admin, apps, I'll go with CRA

Next has one blocking issue for me to use as SPA the last time I try it. It's to maintain react state when you navigate through pages. vercel/next.js#590 I have a youtube player site https://musify.id/ which has an iframe video player that should persist when the user navigating the routes. It always rerenders the iframe so the video would skip.

edit: there are ways to persist the iframe (see the linked issue), but it's not obvious for me at the time.

For analytics, you can't go wrong with both. https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications?hl=en

@Timer
Copy link
Contributor

Timer commented Jun 18, 2017

Last time I checked all major search engines can index SPAs (made with CRA), no SSR necessary.

@viankakrisna
Copy link
Contributor

@Timer search engine yes, but sharing the app with Facebook still gave me blank page last time i checked.

@viankakrisna
Copy link
Contributor

viankakrisna commented Jun 18, 2017

also, I've read that google webmaster tool chucked with CRA generated app because we didn't provide Array.find polyfill #746 So for default, we leave it to the user whether or not the app is SEO friendly.

@ianschmitz
Copy link
Contributor

There's very little "lock-in" when using CRA. You shouldn't have much of any issue with code portability if you decided you needed some features that CRA doesn't provide out of the box. You can also eject and customize if needed.

I wouldn't get caught up in SSR, code splitting etc when starting out. They do have their place but also increase the complexity which takes away from learning the basics.

@cr101 cr101 changed the title CRA vs NextJS CRA vs Next.js Jun 20, 2017
@cr101 cr101 changed the title CRA vs Next.js Create-React-App vs Next.js Jun 20, 2017
@jabacchetta
Copy link

jabacchetta commented Sep 7, 2017

Search engines can index SPAs without SSR, but can they do it efficiently? See this and this. TL;DR: Probably not.

And for web apps that depend on large amounts of traffic, it's not only a matter of indexing, but also social sharing that actually works, and initial rendering speed (for the search engines, but more importantly for their users).

So while SSR, code-splitting, and pre-fetching might be nice-to-haves for some, it's crucial for others.

@cr101
Copy link
Contributor Author

cr101 commented Sep 7, 2017

@jabacchetta You might want to look at GatsbyJS as well

@raymondsze
Copy link

If someone want to change the babel or webpack or jest configuration, and also want SSR, or even some specific scripts like translating i18n messages, etc.

I just published a library called 'create-react-scripts'.
The underlying concept is same as what "react-app-rewired" did but you are able to re-publish it like your version of react-scripts which "react-app-rewired" not allow you to do so. Although complicated, you can create your own custom scripts based on the configuration provided by create-react-app too.
You are allowed to rewire the env, paths, webpack.config.dev, webpack.config.prod, webpackDevServer.config and createJestConfig yourself.

I have created one called 'create-react-scripts-ssr' which can support SSR.

I am still a newbie on open source community, looking for feedback on this approach.
https://github.com/raymondsze/create-react-scripts

@gaearon
Copy link
Contributor

gaearon commented Jan 8, 2018

Going to close this out, but we offer some guidance in the README now.

https://github.com/facebookincubator/create-react-app#popular-alternatives

@gaearon gaearon closed this as completed Jan 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants