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

Update recommended React toolchains, add Vite. #3828

Closed
wants to merge 2 commits into from
Closed

Update recommended React toolchains, add Vite. #3828

wants to merge 2 commits into from

Conversation

leerob
Copy link
Contributor

@leerob leerob commented Aug 3, 2021

This PR was sparked by this comment in the CRA repo: facebook/create-react-app#11180 (comment)

Starting with 2.0, it’s [CRA] mostly in maintenance mode and does not strive to be the best tool for production React apps. It is a tool to get started and get something running fast. Perhaps, it’s not even best at that anymore.

I've updated the docs to reflect this. I've also tried to remove words like "popular" (describing Next.js) and "best" (describing Gatsby) to be more unopinionated. I tried to be as unbiased as possible, so please suggest any changes that could make this more clear.

@facebook-github-bot
Copy link
Collaborator

Hi @leerob!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@netlify
Copy link

netlify bot commented Aug 3, 2021

✔️ Deploy Preview for reactjs ready!
Built without sensitive environment variables

🔨 Explore the source changes: 2a7455c

🔍 Inspect the deploy log: https://app.netlify.com/sites/reactjs/deploys/61097f17560765000794225d

😎 Browse the preview: https://deploy-preview-3828--reactjs.netlify.app

@facebook-github-bot
Copy link
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Member

@3imed-jaberi 3imed-jaberi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@rachelnabors
Copy link
Contributor

Thanks for your contribution—it's very close to the new page for the new site! We were considering updating the current content, but now we will have to consider just merging your contribution!

@leerob
Copy link
Contributor Author

leerob commented Aug 19, 2021

@rachelnabors Anything else you need from me here?


Learn Gatsby from [its official guide](https://www.gatsbyjs.org/docs/) and a [gallery of starter kits](https://www.gatsbyjs.org/docs/gatsby-starters/).

### Create React App {#create-react-app}

[Create React App](https://github.com/facebookincubator/create-react-app) is framework for **small, [single-page](/docs/glossary.html#single-page-application) applications** in React.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to keep old description here, but remove "comfortable" and best". Something like this:

Create React App is a pre-configured environment which lets you start building single-page application or just learning React without configuring build tools like webpack or Babel.

My main concerns with proposed version are:

is framework

It puts CRA on the same shelf with Next.js and Gatsby, but CRA provides almost no guidelines on app structure. Maybe it can serve as a difference here instead: if you want a framework, use Next.js or Gatsby.

for small applications

I'd say size should not be differentiating point here. CRA can be a suitable choice for medium-sized or even large apps unless you need to configure something in underlying tools.

Seems like "small" here means "simple" or even "quite typical single-page app with predictable build tooling requirements" :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@44px Would you prefer changing "small" to "non-production" to match Dan's comment?

...starting with 2.0, [CRA is] mostly in maintenance mode and does not strive to be the best tool for production React apps. It is a tool to get started and get something running fast. Perhaps, it's not even best at that anymore.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it can nudge someone to build app with custom webpack config because they have "production" app :)

For the last year I saw at least two apps with config problems:

  • One had broken caching because of improperly set chunk name
  • Second had large production bundle because of inlined source maps

Both problems have simple fixes, but they might not happen at all if these apps were built with CRA. And they could, these were "simple" apps.

I still see the CRA as the only option if you need to build "classic SPA". It provides good DX (TypeScript support, Fast Refresh, babel-macro, using SVGs as React components, detection of CSS modules, REACT_APP_* env vars substitution) and produces optimized production bundles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the "without configuring build tools like webpack or Babel" to the Next.js and Gastby descriptions too?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! We don't need to say this at all because all tools from "Recommended Toolchains" section are zero-config.

@nickserv
Copy link
Contributor

nickserv commented Sep 16, 2021

Is there a chance we could get Vite listed under "The React team primarily recommends these solutions" alongside create-react-app? It has a lot of overlap with CRA's use case so it's a useful alternative (mainly because it's faster and has plugins), but CRA is still useful for more advanced use cases and older apps, so IMO we should recommend both so users can decide which fits their use case better.

@leerob
Copy link
Contributor Author

leerob commented Feb 3, 2022

Hey @rachelnabors! Wanted to check in here. Anything more you need from me?

@harish-sethuraman
Copy link
Collaborator

Can you rebase your changes please?

@leerob
Copy link
Contributor Author

leerob commented Feb 5, 2022

@harish-sethuraman done, thank you!

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

Size Changes

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

- If you're building a **static content-oriented website,** try [Gatsby](#gatsby).
- If you're building a **static or server-rendered application,** use [Next.js](#nextjs).
- If you're building a **static content-oriented website,** use [Gatsby](#gatsby).
- If you're building a **[single-page app](/docs/glossary.html#single-page-application)**, use [Create React App](#create-react-app).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the beta.reactjs.org we still recommend create-react-app if they are just getting started. Not sure how @gaearon feels about this? We might want to make it consistent in both sites.

@gaearon
Copy link
Member

gaearon commented Feb 7, 2022

How do you feel about the messaging on the new site? I think it's confusing that we have the newer messaging there, and now we have an intermediate version. Would this PR still be valuable after the beta website ships?

@leerob
Copy link
Contributor Author

leerob commented Feb 21, 2022

From the new messaging:

If you’re just getting started with React, we recommend Create React App, the most popular way to try out React’s features and a great way to build a new single-page, client-side application. Create React App is an unopinionated toolchain configured just for React.

My only confusion is that this seems to conflict with this comment.

Starting with 2.0, it’s [CRA] mostly in maintenance mode and does not strive to be the best tool for production React apps. It is a tool to get started and get something running fast. Perhaps, it’s not even best at that anymore.

@leerob leerob closed this by deleting the head repository Sep 11, 2022
@nickserv
Copy link
Contributor

@leerob Hi, was closing this intentional?

@leerob
Copy link
Contributor Author

leerob commented Sep 11, 2022

Oh whoops, yeah I forgot that would happen. I was cleaning up my mess of forked repos.

I'll defer to Dan – happy to roll this forward to the news docs site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants