File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,11 @@ class TransitionGroup extends React.Component {
104
104
105
105
componentDidMount ( ) {
106
106
this . appeared = true
107
+ this . mounted = true
108
+ }
109
+
110
+ componentWillUnmount ( ) {
111
+ this . mounted = false
107
112
}
108
113
109
114
static getDerivedStateFromProps (
@@ -127,12 +132,14 @@ class TransitionGroup extends React.Component {
127
132
child . props . onExited ( node )
128
133
}
129
134
130
- this . setState ( state => {
131
- let children = { ...state . children }
135
+ if ( this . mounted ) {
136
+ this . setState ( state => {
137
+ let children = { ...state . children }
132
138
133
- delete children [ child . key ]
134
- return { children }
135
- } )
139
+ delete children [ child . key ]
140
+ return { children }
141
+ } )
142
+ }
136
143
}
137
144
138
145
render ( ) {
You can’t perform that action at this time.
0 commit comments