react-native中热重载和快速刷新的区别 [英] Difference between hot reload and fast refresh in react-native

查看:68
本文介绍了react-native中热重载和快速刷新的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

react-native0.61 之前的版本中,我们有两种选择.

In versions before 0.61 of react-native for reflecting code changes, we have two options.

  1. 实时重新加载(检测到一些变化时重新加载应用程序)
  2. Hot Reload(无需重新加载即可反映更改)

但在 0.61 版本中,删除这两个(实时重载、热重载)后,引入了一个名为 快速刷新 的新开发者功能,其工作方式也类似于 热重载所以现在的问题是快速刷新热重载之间的根本区别是什么.

but in the version 0.61, removing these two (Live Reload, Hot Reload) there is been a new developer feature introduced named Fast Refresh which also works similar to Hot Reload so now the question is what is the fundamental difference between Fast Refresh and Hot Reload.

推荐答案

热重载"功能被破坏.对于功能组件,它不能可靠地工作,经常无法更新屏幕,并且对拼写错误和错误没有弹性.他们听说大多数人关闭它是因为它太不可靠了.

The "hot reloading" feature was broken. It didn’t work reliably for function components, often failed to update the screen, and wasn’t resilient to typos and mistakes. They heard that most people turned it off because it was too unreliable.

在 React Native 0.61 中,他们将现有的实时重新加载"(保存时重新加载)和热重新加载"功能统一为一个名为快速刷新"的新功能.快速刷新是根据以下原则从头开始实施的:

In React Native 0.61, they’re unifying the existing "live reloading" (reload on save) and "hot reloading" features into a single new feature called "Fast Refresh". Fast Refresh was implemented from scratch with the following principles:

  • 快速刷新完全支持现代 React,包括函数组件和钩子.
  • Fast Refresh 在打字错误和其他错误后优雅地恢复,并且需要时回退到完全重新加载.
  • 快速刷新不执行侵入性代码转换,因此足够可靠,可以默认开启.

从官方文档中了解更多信息

这篇关于react-native中热重载和快速刷新的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆