React rendering component, image cache problem?

The

scenario is as follows:
Route-sharpbase to an information filling page, and only upload the image. After the image is uploaded successfully, when you switch to-sharphome, and then to-sharpbase page, the picture still exists. From a business point of view, when you switch back to-sharpbase again, the head_ Picture value is empty, but after react rendering, there are images on the dom.

clipboard.png

tried setState ({head_pic: ""}) in componentDidMount and did not solve it.


did you write the picture information in the global similar redux?


does not. The picture is in the sub-component


after the upload page is successfully uploaded, the route switch belongs to the component Unmount, only the value in state is destroyed, but this data change will not actively trigger your update of the component, that is, the resulting instance has not changed. It is recommended that after the manual upload is completed, operate on the state to generate a new instance, and then the image will not be remembered.

Menu