Skip to content

Commit 0d61d5f

Browse files
committed
fix cloning existing props
1 parent 8902a35 commit 0d61d5f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-web-component",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Create Web Components with React",
55
"main": "src/index.js",
66
"types": "index.d.ts",
@@ -16,6 +16,7 @@
1616
"@webcomponents/shadydom": "^1.4.3"
1717
},
1818
"peerDependencies": {
19+
"react": "^16.2.0",
1920
"react-dom": "^16.2.0"
2021
},
2122
"devDependencies": {

src/dev/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const React = require('react');
12
const ReactDOM = require('react-dom');
23
const retargetEvents = require('react-shadow-dom-retarget-events');
34
const getStyleElementsFromReactWebComponentStyleLoader = require('./getStyleElementsFromReactWebComponentStyleLoader');
@@ -61,9 +62,8 @@ module.exports = {
6162
retargetEvents(shadowRoot);
6263
}
6364

64-
ReactDOM.render(app, mountPoint, function () {
65+
ReactDOM.render(React.cloneElement(app, extractAttributes(webComponentInstance)) , mountPoint, function () {
6566
appInstance = this;
66-
appInstance.props = Object.assign(extractAttributes(webComponentInstance), appInstance.props);
6767

6868
callConstructorHook(webComponentInstance);
6969
callLifeCycleHook('connectedCallback');

src/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)