I came to the kind of anyoing problem. So, I have a component in react
and also using react-router
. Everything works almost great. This component has a list of items, when you click on one, it pushes url to the iframe[src={url}]
. And here appears the problem, if I will click on several items and then click on the previous page/back button, instead of going to the previous page, it just shows the previous iframe of url that was pushed to iframe.
What do I do in this situation?
@I'm using react-router-dom v4
Don't just change the src. You've to replace a new iframe everytime the src change. By doing that without change things much, just add difference key to your iframe everytime you change src
render(){
const iframe = <iframe key={this.thing.id} src={this.thing.src} ></iframe>
return(iframe)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.