Using react-router I'm looking for a way to update the page URL / hash, without the router re-rendering the whole page.
I am developing a full page carousel, and would like each slide to have it's own URL (allowing the user to refresh the page and return to the correct slide). The carousel will later have swipe similar to this demo, which means the next slide is pre-rendered.
A stripped down version of my carousel is available here.
The current slide change looks like this:
onClickLeft: function() {
this.setState({
selected: this.state.selected - 1
});
}
This works fine, with no URL updates. What I really want is:
mixin: [Navigation],
onClickLeft: function() {
this.transitionTo('carousel-slide', {num: this.state.selected + 1});
}
This would set the prop of the current slide, allowing the carousel to animate. However using this method now causes the page to re-render and no animation is displayed.
I have seen the ReactCSSTransitionGroup
used for route transitions, however this seems geared toward rendering a new page and transitioning out the old one.
If there's already a way to achieve what I'm looking for, and I've missed it, could someone point me in the right direction?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…