reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
11.03k stars 7.53k forks source link

Documentation on deploying ReactJS applications #459

Open msert29 opened 6 years ago

msert29 commented 6 years ago

The current state of ReactJS documentation is superb and rapidly evolving but I personally think that when it comes to deployment of ReactJS applications and to a lesser extent React Native apps. There are some good tutorials but having an official guide to deploying ReactJS/React Native applications would be fantastic topic on React documentation.

icarlossz commented 6 years ago

It sounds like a good idea, you have to make some sample version to show how it would look. I think.

gaearon commented 6 years ago

It really depends on the toolkit you use, doesn't it?

Create React App provides extensive deployment instructions here but for Next.js, Gatsby, our custom setups the instructions would be different.

msert29 commented 6 years ago

I do agree that it depends on the toolkit but whilst the deployment instructions are clearly outlining steps for NodeJS backends, there are no suggestions or guidelines for other backends such as Python Django/Flask or Ruby on Rails. To give an example, when it comes to integration, one could use Webpack and Django webpack loader module and integrate ReactJS into Django directly. The second but more sound complex option is to completely segregate backend & frontend and serve them on different ports and proxy the backend. I've seen many developers trying to integrate ReactJS into their current stack but bewilderedly giving up due to integration issues. Maybe we can have subsections within the deployment or integration documentation for mainstream web frameworks and not limit it to NodeJS ?

alexkrolick commented 6 years ago

The issue is that bundling and deployment are really outside of the React library's scope. As Dan pointed out, CRA provides deployment instructions appropriate to its output, but depending on if you use Webpack, <script> tags, Browserify, the Rails asset pipeline, etc., the instructions would be very different.

markerikson commented 6 years ago

I think we should still add a "basic/typical deploy steps" examples to the docs, even if it just amounts to "most apps will have an index.html, app.js, app.css, etc. Upload those to the static web host of your choice". I'd make it a separate page, but link to the "production" page.

Possibly related: it'd be good to have info on how to go from something like a CodePen to a CRA app.

Relevant example of a very confused brand new user: https://www.reddit.com/r/reactjs/comments/8u2wgv/dont_understand_how_to_actually_deploy_react_on_a/