Last active
October 9, 2019 11:59
-
-
Save MakeHoney/4586616e1c3234414e4e0adae4988225 to your computer and use it in GitHub Desktop.
react-hot-loader code snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package.json | |
... | |
"react-hot-loader": "^4.12.15", | |
"@hot-loader/react-dom": "^16.8.6", | |
... | |
// webpack.config.js | |
module.exports = { | |
... | |
resolve: { | |
alias: { | |
'react-dom': '@hot-loader/react-dom' | |
} | |
}, | |
... | |
plugins: [ | |
... | |
new webpack.HotModuleReplacementPlugin() | |
... | |
], | |
... | |
devServer: { | |
... | |
hot: true, | |
inline: true, | |
... | |
} | |
} | |
// App.js | |
import React from 'react' | |
... | |
import { hot } from 'react-hot-loader' | |
const App = () => { | |
return ( | |
... | |
) | |
} | |
export default hot(module)(App) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment