Hi,
im creating a PDF with jspdf-react but the pdf not appeared in DOM because is state stay at false
its working when i add the pdf component on a loading page, but not when i added it from click event
im new to react, so i miss something maybe ?
what i do :
i have class PdfCalendar who render a component inside a <React.Fragment>
<React.Fragment>
<PDF
properties={properties}
preview={false} // i have tried with true
previewWidth={1590}
orientation={'landscape'}
save={true} // tried withoutt
filename={"test.pdf"}// tried withoutt
>
<Rectangle x={0} y={0} width={842} height={16} fill={'#2a2c36'} color={'#2a2c36'} style={'F'} />
<Image x={0} y={0} src={logo} width={50} height={16.625} /> /// logo in base64
</PDF>
</React.Fragment>
the class is exported like this :
export default PdfCalendar;
in my main page component i have a button binded by a function > click: this.handlePDFClick
My handlePDFClick function juste set a state variable at true
and in my render i have this :
{this.state.pdf && <PdfCalendar events={this.state.events} /> }
i miss something ? when i remove this.state.pdf condition, its working but not charging events and the pdf is not refreshing when state.events change
in my devtools component i can see that the PDF component stay at loading:false, when i manually pass this loading state at true, everything is OK and the pdf is showed or downloaded
Hi,
im creating a PDF with jspdf-react but the pdf not appeared in DOM because is state stay at false
its working when i add the pdf component on a loading page, but not when i added it from click event
im new to react, so i miss something maybe ?
what i do :
i have class PdfCalendar who render a component inside a <React.Fragment>
the class is exported like this :
export default PdfCalendar;in my main page component i have a button binded by a function > click: this.handlePDFClick
My handlePDFClick function juste set a state variable at true
and in my render i have this :
{this.state.pdf && <PdfCalendar events={this.state.events} /> }i miss something ? when i remove this.state.pdf condition, its working but not charging events and the pdf is not refreshing when state.events change
in my devtools component i can see that the PDF component stay at loading:false, when i manually pass this loading state at true, everything is OK and the pdf is showed or downloaded