Skip to content

Commit 5cdadea

Browse files
le0nikmarnusw
authored andcommitted
Allows child component to be null
1 parent f315e50 commit 5cdadea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ReactCSSTransitionReplace.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export default class ReactCSSTransitionReplace extends React.Component {
7575
};
7676

7777
state = {
78-
currentChild: this.props.children ? React.Children.only(this.props.children) : null,
78+
currentChild: this.props.children ? React.Children.only(this.props.children) : undefined,
7979
currentChildKey: this.props.children ? '1' : '',
80-
nextChild: null,
80+
nextChild: undefined,
8181
nextChildKey: '',
8282
height: null,
8383
isLeaving: false
@@ -179,7 +179,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
179179
this.setState({
180180
currentChild: state.nextChild,
181181
currentChildKey: state.nextChildKey,
182-
nextChild: null,
182+
nextChild: undefined,
183183
nextChildKey: '',
184184
height: null
185185
});
@@ -195,7 +195,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
195195
// element must be removed from the DOM if the enter transition is still in progress.
196196
_handleDoneLeaving = () => {
197197
if (this.isTransitioning) {
198-
const state = {currentChild: null, isLeaving: false};
198+
const state = {currentChild: undefined, isLeaving: false};
199199

200200
if (!this.state.nextChild) {
201201
this.isTransitioning = false;
@@ -210,7 +210,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
210210
this.isTransitioning = false;
211211
clearTimeout(this.timeout);
212212
return this.setState({
213-
nextChild: null,
213+
nextChild: undefined,
214214
nextChildKey: '',
215215
height: null
216216
});

0 commit comments

Comments
 (0)