React Native 快速刷新 - 在当前页面重新加载
我想知道是否可以将 React Native 快速刷新配置为仅在导入的文件被修改时重新加载当前页面。我正在开发一个具有许多连续页面的应用程序,当快速刷新重新加载整个应用程序时,我必须导航许多页面才能返回到我正在处理的页面。
任何建议都非常感激。
I would like to find out if it is possible to configure the React Native Fast Refresh to only reload the current page in case imported files are modified. I'm working on an app that has many sequential pages and when the Fast Refresh reloads the entire app, I have to navigate many page to get back to the page I'm working on.
Any suggestions greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用
reload
方法告诉浏览器重新加载当前页面:此方法采用一个可选参数,默认设置为 false。如果设置为 true,浏览器将从服务器而不是页面的缓存版本执行完整的页面刷新。
由于 React 使用 JavaScript 作为其核心,因此您可以随时随地使用普通 JavaScript。
React 组件内的
location.reload
方法:call the
reload
method to tell the browser to reload the current page:This method takes an optional parameter which by default is set to false. If set to true, the browser will do a complete page refresh from the server and not from the cached version of the page.
As React uses JavaScript at its core, therefore you can use vanilla JavaScript whenever and however you want.
location.reload
method inside of a React component: