Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- Tests now uses headless chrome instead of Poltergeist
- Babel is configured with `babel-preset-env`
- Updated React syntax to v18

### Removed
- Support for `react-hot-loader`. Please look at the README for instructions on how to use `react-hot-loader` 4 with your app, it is much simpler and better!
Expand Down
7 changes: 4 additions & 3 deletions javascript/webpacker_react-npm-module/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { createRoot } from 'react-dom/client'
import intersection from 'lodash/intersection'
import keys from 'lodash/keys'
import assign from 'lodash/assign'
Expand All @@ -17,8 +17,9 @@ const WebpackerReact = {
const props = propsJson && JSON.parse(propsJson)

const reactElement = React.createElement(component, props)
const root = createRoot(node)

ReactDOM.render(reactElement, node)
root.render(reactElement)
},

registerComponents(components) {
Expand All @@ -34,7 +35,7 @@ const WebpackerReact = {
unmountComponents() {
const mounted = document.querySelectorAll(`[${CLASS_ATTRIBUTE_NAME}]`)
for (let i = 0; i < mounted.length; i += 1) {
ReactDOM.unmountComponentAtNode(mounted[i])
mounted[i].unmount()
}
},

Expand Down