Comments (6)
If anyone still needs this, React Hot Loader 4 is trivial to integrate. The only changes needed are
- A custom .babelrc:
{
"presets": [
"razzle/babel"
],
"plugins": [
"react-hot-loader/babel"
]
}
- Wrapping the App export in the
hot
HOC:
import React from 'react';
import Route from 'react-router-dom/Route';
import Switch from 'react-router-dom/Switch';
import Home from './Home';
import './App.css';
import { hot } from 'react-hot-loader'; // !!!
const App = () => (
<Switch>
<Route exact path="/" component={Home} />
</Switch>
);
export default hot(module)(App); // !!!
@jaredpalmer maybe this could be made the default setup when RHL 4 is officially released?
from razzle.
Thanks! Feel free to submit a PR. I have been using react-hot-loader on other projects, seems to work
really well.
from razzle.
Cool, i'll try submitting one later this week!
from razzle.
Hi Jared,
Don't have the time atm to wrap up a PR, sorry. Since the react-hot-loader is still in development, i'll try to create it when it has been released :) Closing for now
from razzle.
@andrewpeterprifer THANK YOU, THIS IS AWESOME. RHL4 brings so many great features!
from razzle.
Adding to the solution AndrewPrifer provided above, if you need hooks support do the following.
NOTE: These steps are adapted for razzlejs from the official way to do this found here https://github.com/gaearon/react-hot-loader#hot-loaderreact-dom
npm install --save @hot-loader/react-dom@YOUR-REACT-DOM-VERSION
- Adjust razzle.config.js to use the patched react-dom (from hot-loader) instead of the regular react-dom
// razzle.config.js
module.exports = {
modify: (config, { target, dev }, webpack) => {
// THIS LINE IS THE MAGIC JUICE
config.resolve.alias['react-dom'] = '@hot-loader/react-dom'
return config;
},
};
from razzle.
Related Issues (20)
- Razzle hangs after compiling- Script exited with code 0 HOT 1
- loadable-components example requires JS enabled to display CSS in development HOT 1
- Using Apollo Client Cache Rehydration in Razzle with SSR HOT 1
- Release notes are very cumbersome when doing version comparisons HOT 2
- HMR does not activate when a file containing only types is modified
- Dependency Terminate uses GPLv2 License - any alternative?
- Can't deploy to heroku
- plugin options are coming to be undefined HOT 4
- Content Security Policy Implementation HOT 1
- Regarding deployment in server HOT 5
- For Laravel project, add it where ? please HOT 1
- Is the project abandoned? 🤔 HOT 8
- How to expose config to out ?
- digital envelope routines::unsupported HOT 1
- Why razzle forcing buffer and process package in ProvidePlugin if webpack version is 5
- Unexpected token: punc (.) HOT 6
- Does latest razzle support react 18 ?
- Support for react 18 HOT 3
- ~Wrong repo~
- How to use webpack 5 with Razzle 4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from razzle.