0 votes
I've got simple app with React+Webpack2+react-hot-loader that showing data-table from Json file.

import Data from '../../src/data/last.json';
And when I start "webpack-dev-server" all info showing by table dynamically changes without full page refresh, when "last.json" overwrites with another app.

I'm using examples from GitHub react-hot-boilerplate and already read WebPack off doc about HMR, which says that:

The Hot Module Replacement functionality is not intended for use in production. You should only use it in your development configuration/environment.

Question: Can I ever achieve this behavior on production with hot-loader or only by ajax?

Or I need start using Redux with "changing store on the fly" on back-end?
Now i'm using php back-end with API's to front on React and I thought it'll be enough for my tasks. Am I wrong?
asked Dec 30, 2017 in JAVASCRIPT by Amrendra | 38 views

1 Answer

0 votes
Hot reloading is actual in development process where modifications is frequently occurred. Single page application in production is loaded once and worked on client side all time. When you release new version of application to production you need to push somehow signal to client side application to reload. The client side application performs reloading whenever it is suitable to application logic.

Your json file is hot-reloaded to client application after each modification because it is working process of webpack build and hot reloading. Usually, the data does not fall into the application via a file from the disk but as server program reply. And hot loading does not have such possibility to serve application data transfer. Your json file falls into application as a modified source file. Hot reloading is considering your json as source file and hot reloading it into application after changes.

Hot reloading is development building process. It is not application working process.
answered Dec 30, 2017 by Amrendra

Related Questions

Welcome to Knowledge Boostr, where you can ask questions and receive answers from other members of the community.
This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top Q&A for professional and enthusiast programmers Q&A for professional and enthusiast programmers Q&A for professional and enthusiast programmers Q&A for professional and enthusiast programmers

23,494 questions
40,169 answers
23,610 users