Starting from the state of that Products
is rendered.
I want Products
above to exit with animation and ProductDetailPhotos
to appear when clicking NavLink to={'/product-detail/' + variant.id}
which exists in Products
view , however, firstly Products
above is replaced by new ProductDetailPhotos
and new another ProductDetailPhotos
appear after it.
<TransitionGroup component="main" className="page-main">
<CSSTransition key={location.pathname} timeout={timeout} classNames="fade" appear>
<Switch location={location}>
<Route exact path={'/'} component={ () =>
<Products
productsArray={this.state.myProductsArray}
client={this.props.client}
/>
}/>
<Route path='/product-detail/:variantId' render={props =>
<ProductDetailPhotos
products={this.state.products}
client={this.props.client}
addVariantToCart={this.addVariantToCart}
{...props}
/>
}/>
<Route component={NotFoundPage} />
</Switch>
</CSSTransition>
</TransitionGroup>
I explain actual by time series as below:
Products DOM
is rendered- Click NavLink to /product-detail
Products DOM
changes toProductDetailPhotos 1 DOM
with fade-exit classes immediately thenProductDetailPhotos 2 DOM
with fade-appear classes is renderedProductDetailPhotos 1 DOM
andProductDetailPhotos 2 DOM
start animation by CSS.ProductDetailPhotos 1 DOM
animates to exit andProductDetailPhotos 2 DOM
does to enter.ProductDetailPhotos 1 DOM
finally disappear
My Expectation is below:
Products DOM
is rendered- Click NavLink to /product-detail
ProductDetailPhotos DOM
is rendered first with fade-appear classes- Then
Products DOM
starts animating to exit by CSS with fade-exit classes andProductDetailPhotos DOM
too with fade-appear classes.
Thanks.