Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Return null transition children #68

Open
adammockor opened this issue Jan 22, 2017 · 1 comment
Open

Return null transition children #68

adammockor opened this issue Jan 22, 2017 · 1 comment

Comments

@adammockor
Copy link

If I change in your example this:

{
  this.state.modalOpen &&
  <div key="modal" className="modal__content" style={{background: '#F1F2F3'}}>
    Hey I am a modal!
    <a onClick={this._toggleModal} className="modal__close"></a>
  </div>
}

to this:

{
  this.state.modalOpen
    ? (
      <div key="modal" className="modal__content" style={{background: '#F1F2F3'}}>
        Hey I am a modal!
        <a onClick={this._toggleModal} className="modal__close"></a>
      </div>
    )
    : null
}

I will get errors:

Warning: Failed prop type: Required prop `styles` was not specified in `TransitionMotion`.
    in TransitionMotion (created by Transition)
    in Transition (created by Modal)
    in aside (created by Modal)
    in div (created by Modal)
    in Modal (created by App)
    in div (created by App)
    in App

Uncaught TypeError: Cannot read property 'map' of null
    at Constructor.getInitialState (VM690 TransitionMotion.js:234)
    at new Constructor (VM529 ReactClass.js:670)
    at eval (VM630 ReactCompositeComponent.js:296)
    at measureLifeCyclePerf (VM630 ReactCompositeComponent.js:76)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (VM630 ReactCompositeComponent.js:295)
    at ReactCompositeComponentWrapper._constructComponent (VM630 ReactCompositeComponent.js:281)
    at ReactCompositeComponentWrapper.mountComponent (VM630 ReactCompositeComponent.js:189)
    at Object.mountComponent (VM567 ReactReconciler.js:47)
    at ReactCompositeComponentWrapper.performInitialMount (VM630 ReactCompositeComponent.js:372)
    at ReactCompositeComponentWrapper.mountComponent (VM630 ReactCompositeComponent.js:259)

Difference is that, first example returns false and second returns null which should be valid react children.

@rico345100
Copy link

I got same error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants