Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit dd1fc49

Browse files
committed
🐞 with-lifecycle: fix a React warning caused by onReceiveProps (close #27)
1 parent 3a154ce commit dd1fc49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/with-lifecycle/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default (methodsArg) => (Target) => {
2626
}
2727

2828
if (methods.onReceiveProps) {
29-
this.state = props
29+
this.state = { ...props }
3030

3131
WithLifecycle.getDerivedStateFromProps = (nextProps, prevState) => {
3232
methods.onReceiveProps(prevState, nextProps)

0 commit comments

Comments
 (0)