title: react-transition-group conditionally animate out
body: <p>I'm trying to use <code>react-transition-group</code> to add some animation to a list that I have.</p>
  
  <p>This is my general setup, I have list component that renders a number of children. There are a number of interactions that cause items to be added/removed from this list. Some of these actions need to cause the component to be removed using an animation but I can't seem to get that working and I'm guessing maybe I'm missing something here. </p>
  
  <p>This is my basic setup:</p>
  
  <pre><code>&lt;TransitionGroup className="list" component="ul"&gt;
     {this.props.item.map(item =&gt; (
        &lt;CSSTransition key={item.id} timeout={500} classNames="fade" enter={false} exit={!!item.shouldAnimate}&gt;
          &lt;ChildComponent/&gt;
        &lt;/CSSTransition&gt;
      ))}
  &lt;/TransitionGroup&gt;
  </code></pre>
  
  <p>I have verified that everything is fine in my state logic (i.e. <code>shouldAnimate</code> is set to <code>true</code> as I expect but it still doesn't animate.</p>
  
  <p>Any suggestions?</p>
  
  <p>Edit:
  Created a fiddle showing the problem and I think I now see the issue.
  <a href="http://jsfiddle.net/af0ee2eo/2/" rel="nofollow noreferrer">http://jsfiddle.net/af0ee2eo/2/</a></p>
  
  <p>As I described above I don't know until the user takes an action if that action should be one that causes the item to be animated or not when it is removed from the list. I'm setting <code>shouldAnimate</code> correctly but then before the next render I'm removing that item from the list. If I delay the removal until after the next render things work okay but that's annoying to have to do every time (this is what I am demonstrating by the "Use Delay?" checkbox at the bottom of the fiddle). I wish there was a way to inject state into the state of the item held by TransitionGroup's component state.</p>
  
  <p>If anyone has any other idea how I might fix this without a <code>setTimeout</code> or <code>requestAnimationFrame</code> render hack let me know otherwise I'll just mark this question as answered.</p>