Skip to content

Commit

Permalink
bump supported react version to 18
Browse files Browse the repository at this point in the history
  • Loading branch information
tswayne committed Jun 25, 2022
1 parent a806ebf commit 8d1c83b
Show file tree
Hide file tree
Showing 5 changed files with 2,285 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [4.0.0] - 6/25/2022
- Upgrade to react 18

## [3.2.0] - 4/15/2018
- Feature: Create class to expose helper functionality as needed

Expand Down
11 changes: 4 additions & 7 deletions lib/front-end/reactComponentRenderer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var React = require('react');
var reactDom = require('react-dom');
var reactDom = require('react-dom/client');

module.exports.findContainerAndRenderComponent = function (component, serverRender, frontEndProps){
var componentName = Object.keys(component)[0];
Expand All @@ -12,13 +12,10 @@ module.exports.findContainerAndRenderComponent = function (component, serverRend
}

if (serverRender) {
reactDom.hydrate((
React.createElement(component[componentName], props)
), dest);
reactDom.hydrateRoot(dest, React.createElement(component[componentName], props))
} else {
reactDom.render((
React.createElement(component[componentName], props)
), dest);
const root = reactDom.createRoot(dest)
root.render(React.createElement(component[componentName], props))
}
}
};
Loading

0 comments on commit 8d1c83b

Please sign in to comment.