mardi 23 avril 2019

Re-render a component without reloading the page - React

im working on a upload and previsualization application. To get a prev of the file im using react-pdf-js the problem that is that every time that i upload a file the page refresh automatically and i need to be previewed without refresh the page. I use a state to have the control of the file if exist or no, every time that the user upload a file the state change the value.

This is my code:

<div className="card-img-top ">
                        {(this.state.archivo==='si') && <PDF
                                                        file={require('../../../../files/' + this.props.CURP + '_' + this.props.simple)}
                                                        renderMode="svg"
                                                        scale={0.2}
                                                    />}
                         {(this.state.archivo==='no')&& <div className="noImage">
                            <Image src={Imagen} style=/>
                         </div> }
                    </div>




Aucun commentaire:

Enregistrer un commentaire