diff --git a/frontend/src/scripts/index.js b/frontend/src/scripts/index.js index 9418640..93b8f23 100644 --- a/frontend/src/scripts/index.js +++ b/frontend/src/scripts/index.js @@ -49,6 +49,7 @@ class Main extends Component { new_index += this.state.photos.length } this.setState({currentImage: new_index}) + this.carousel && this.carousel.setState({currentIndex: 1}) } onSubmit(event){ event.preventDefault(); @@ -94,8 +95,7 @@ class Main extends Component { } } - let carousel = this.onViewChange(v)}}/> - carousel.setState({currentIndex: 1}) + this.carousel = this.state.photoIsOpen && this.onViewChange(v)}}/> return (