Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
306 views
in Technique[技术] by (71.8m points)

reactjs - React require Hard refresh to show last changes

Every time I update my website, the users need to do a Hard refresh to see the last changes

I search this issue but no result, tried added Tags in my Html file to avoid save cache in my app, the unregister function from the serviceWoker and the library of react-clean-cache but none seem to work

Is there a way to force Browser load my page from scratch ?

React v16.13.1 Node v13.13.0

question from:https://stackoverflow.com/questions/65945583/react-require-hard-refresh-to-show-last-changes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use useHistory from react-router-dom. And then history.go(0) to force the refresh actual page.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...