Javascript React本机导入绑定器/快速刷新怪异行为|导出成员区分大小写

Javascript React本机导入绑定器/快速刷新怪异行为|导出成员区分大小写,javascript,react-native,metro-bundler,Javascript,React Native,Metro Bundler,这是我第一次在导出成员上注意到这种行为。我不确定这是不是因为我缺乏理解 我正在尝试实现一个上下文,我有一个导出的成员/使用者,它将被包装在目标组件周围 React文档中的示例代码 function ThemeTogglerButton() { // The Theme Toggler Button receives not only the theme // but also a toggleTheme function from the context return ( &

这是我第一次在导出成员上注意到这种行为。我不确定这是不是因为我缺乏理解

我正在尝试实现一个上下文,我有一个导出的成员/使用者,它将被包装在目标组件周围

React文档中的示例代码

function ThemeTogglerButton() {
  // The Theme Toggler Button receives not only the theme
  // but also a toggleTheme function from the context
  return (
    <ThemeContext.Consumer>
      {({theme, toggleTheme}) => (
        <button
          onClick={toggleTheme}
          style={{backgroundColor: theme.background}}>
          Toggle Theme
        </button>
      )}
    </ThemeContext.Consumer>
  );
}

export default ThemeTogglerButton;
函数ThemeTogglerButton(){
//主题切换按钮不仅接收主题
//而且还有一个来自上下文的toggleTheme函数
返回(
{({theme,toggleTheme})=>(
切换主题
)}
);
}
导出默认的切换按钮;
除非我在这个函数中更改了一些内容,否则它会触发快速刷新,但会丢失上下文。 现在我不确定这是为什么,但我认为这是一个正常的(但恼人的)上下文行为

奇怪的是,如果我把
按钮打开到
按钮;基本上,将第一个字母改为小写,并更改其中的某些内容,每次都会重新加载整个应用程序

这是正常行为吗?是什么原因造成的

注意:我可能混合了快速刷新和热重新加载这两个术语,但感觉快速刷新是正确的