react-flip-page icon indicating copy to clipboard operation
react-flip-page copied to clipboard

Update the value of startAt after the first render

Open benjaminviaud opened this issue 5 years ago • 1 comments

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

benjaminviaud avatar May 06 '20 15:05 benjaminviaud

Hello, Sorry for the delayed reply… From what you describe, I can see two solutions:

  • Only mount the FlipPage component once you have the data
  • Call gotoPage with the correct index when everything is loaded.

darenju avatar May 28 '20 11:05 darenju