react-flip-page
react-flip-page copied to clipboard
Update the value of startAt after the first render
Hello,
I cannot update the startAt props after the first render because the init value is initialize in constructor with props.
In my case my function render
<FlipPage startAt={numPage} ... >....</FlipPage>
but i fetch book data from db with redux action (content of page, startAt, ...)
componentDidMount(){
this.props.dispatch(getBook())
}
And after the data loaded I cannot update the startAt value. Is there a way to update this value ?
Thanks for your work.
Ben
Hello, Sorry for the delayed reply… From what you describe, I can see two solutions:
- Only mount the
FlipPagecomponent once you have the data - Call
gotoPagewith the correct index when everything is loaded.