1

i successfully connected DRF to react after seeing the posting. https://www.valentinog.com/blog/drf/

but real-time screen update is not possible when the server is run in development mode by typing the phrase.

"webpack --mode development ./src/index.js --output-path ./static/frontend/main.js"
chea
  • 101
  • 1
  • 11
  • To be clear, when you refresh your browser, the app does not have any changes? – Rayyan Dec 24 '20 at 13:18
  • yes even when i changed app.js – chea Dec 25 '20 at 08:55
  • Are you getting any error messages in the npm console? What is showing up on it? Also if you haven't already, definitely try emptying cache and doing a hard reload on whichever browser you are using. – Rayyan Dec 25 '20 at 22:50

1 Answers1

0

you likely need to implement some cache-busting so that when you refresh the page a new version of your assets is picked up. This is part of webpack configuration. See this article about cache-busting.

When linking to a file in your HTML:

<script src="index.js"></script>

The browser will only load it once. Subsequent times it will not load it from the server again as it believes it already has the file cached. In order to get around this webpack can output a unique content hash into the file name so that each time the file is updated, the browser understands it can't use the cached version.

<script src="index.cf532g.js"></script>

This blog post that I wrote explains how to implement cache-busting using webpack and django. It features django-manifest-loader, a package I wrote, in order to link the two together.

rykener
  • 711
  • 1
  • 6
  • 16