diff --git a/crates/oxc_transformer/src/react/refresh.rs b/crates/oxc_transformer/src/react/refresh.rs index ee49396e6811f..e53294b151e3d 100644 --- a/crates/oxc_transformer/src/react/refresh.rs +++ b/crates/oxc_transformer/src/react/refresh.rs @@ -930,7 +930,7 @@ fn is_componentish_name(name: &str) -> bool { } fn is_use_hook_name(name: &str) -> bool { - name.starts_with("use") && name.chars().nth(3).unwrap().is_ascii_uppercase() + name.starts_with("use") && name.as_bytes().get(3).map_or(true, u8::is_ascii_uppercase) } #[rustfmt::skip] diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/generates-valid-signature-for-exotic-ways-to-call-hooks/input.jsx b/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/generates-valid-signature-for-exotic-ways-to-call-hooks/input.jsx index d06e653ec6bc4..fe2c0164669ec 100644 --- a/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/generates-valid-signature-for-exotic-ways-to-call-hooks/input.jsx +++ b/tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/refresh/generates-valid-signature-for-exotic-ways-to-call-hooks/input.jsx @@ -10,5 +10,6 @@ export default function App() { const baz = FancyHook.useThing(); React.useState(); useThePlatform(); + use(); return