Summary
The useProfiler hook is a publicly exported, officially supported API in @sentry/react (re-exported by @sentry/react-native), but it has no documentation on the React Native component tracking page. Users who find it via source discovery have no way to confirm it's safe to rely on, what options it accepts, or how it differs from withProfiler.
Background
The current docs for React Native Component Tracking cover only withProfiler (HOC pattern). The useProfiler hook is a cleaner fit for modern function components — you drop useProfiler("MyComponent") inside the component body without rewiring exports — but it is entirely absent from the docs.
Source reference: profiler.tsx
Scope
- Add
useProfiler hook documentation to the React Native component tracking page (and the React page if it's also missing there)
- Cover: usage example, accepted options (
name, disabled, hasRenderSpan), and a brief comparison to withProfiler noting the trade-offs (hook = cleaner for function components; HOC = also tracks prop-change updates via updateProps)
- Note the shared requirement: tracing must be configured (
tracesSampleRate) or no spans are generated
Dependencies
Action taken on behalf of Chris Stavitsky.
Summary
The
useProfilerhook is a publicly exported, officially supported API in@sentry/react(re-exported by@sentry/react-native), but it has no documentation on the React Native component tracking page. Users who find it via source discovery have no way to confirm it's safe to rely on, what options it accepts, or how it differs fromwithProfiler.Background
The current docs for React Native Component Tracking cover only
withProfiler(HOC pattern). TheuseProfilerhook is a cleaner fit for modern function components — you dropuseProfiler("MyComponent")inside the component body without rewiring exports — but it is entirely absent from the docs.Source reference:
profiler.tsxScope
useProfilerhook documentation to the React Native component tracking page (and the React page if it's also missing there)name,disabled,hasRenderSpan), and a brief comparison towithProfilernoting the trade-offs (hook = cleaner for function components; HOC = also tracks prop-change updates viaupdateProps)tracesSampleRate) or no spans are generatedDependencies
Action taken on behalf of Chris Stavitsky.