question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create React App integrated in an existing application

See original GitHub issue

If I have a react app nested in a server-side rendered page, how would I be able to get react to live-reload while in dev?

Right now, the server renders the page which has a DOM element the CRA app mounts to, to display within the application. It works great since we can’t stop to rewrite the entire application just yet, but we can’t get it to live-reload this way.

Basically my structure is

/app (server)
/public (css/js)
/ui (cra)
/views (server-side)

ui is all the react code, and it gets transpiled and pushed to the /public directory, where it then looks for div ids in /views to mount to. The server generates the page, loads the JS, and React starts running inside the rendered pages, wherever it mounts.

How can I run this app and have react hot-reload to /public for me?

Thanks!

Also, this would be nice to do without ejecting.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
sunnyw1212commented, Mar 28, 2018

nope. still don’t have true live-reload, but i figure it’s still a better dev workflow than having to rebuild every time you want to see a change

1reaction
natdmcommented, Mar 27, 2018

Interesting. That works pretty well but doesn’t live-reload the component, just updates the JS. Do you have a way to do that?

On Fri, Mar 23, 2018 at 9:54 PM, qwertwerty21 notifications@github.com wrote:

our work app has a similar structure to yours. i was messing around with it today and found out you can get live-reloading if you run npm start in the react app and have your server load localhost:3000/bundle.js instead of the final production version of bundle.js

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/4133#issuecomment-375846959, or mute the thread https://github.com/notifications/unsubscribe-auth/AKwACQ0_FManpzUop8ipCigAHBnqiJlkks5thdGVgaJpZM4Sktuk .


Nathan Hyland (602)740-5705

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a New React App
Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in...
Read more >
How to integrate React into an existing app?
Integrating React into an existing application is surprisingly simple. In many cases, it is actually simpler than starting from scratch.
Read more >
Integration with Existing Apps
Integration with Existing Apps. React Native is great when you are starting a new mobile app from scratch. However, it also works well...
Read more >
How to integrate React into an existing multi-page app
This article will walk you through the method I used to piecemeal React into an existing multi-page app, whilst continuing to use existing...
Read more >
Deployment
It also works well when integrated into an existing server side app. Here's a programmatic example using Node and Express:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found