Hi,
I have a parent and a child component. I want to have a button in the child component which onclick calls a function in the parent component. Inside this function I have the scrollToComponent method.
Inside the render method in the parent class I have this
<Home scroll={this.scrollToBooking} />
and in my child I have this
<button className="book-button" onClick={() => props.scroll()}>ORDER NOW</button>
The scroll() method does get executed but the scrolling is not working, anybody know why or is it another way to do this?
scrollToBooking looks like this:
scrollToBooking() { scrollToComponent(this.Booking, { offset: 0, align: 'top', duration: 1000}); }
Hi,
I have a parent and a child component. I want to have a button in the child component which onclick calls a function in the parent component. Inside this function I have the scrollToComponent method.
Inside the render method in the parent class I have this
<Home scroll={this.scrollToBooking} />and in my child I have this
<button className="book-button" onClick={() => props.scroll()}>ORDER NOW</button>The
scroll()method does get executed but the scrolling is not working, anybody know why or is it another way to do this?scrollToBooking looks like this:
scrollToBooking() { scrollToComponent(this.Booking, { offset: 0, align: 'top', duration: 1000}); }