Function: withTrace

@ottrelite/interop-otel.withTrace

withTrace<ComponentProps>(WrappedComponent, traceName): FC<ComponentProps & WithTraceProps>

Higher-order component that supplies the wrapped component with a wrapped useTracer hook that is already scoped to the proper name of the component.

Type parameters

NameType
ComponentPropsextends IntrinsicAttributes

Parameters

NameTypeDescription
WrappedComponentComponentType<ComponentProps & Partial<WithTraceProps>>The component to wrap with tracing
traceNamestringOptional name name of the trace; if not provided, displayName of the component will be used.

Returns

FC<ComponentProps & WithTraceProps>

A higher-order component that wraps the given component with tracing

See

useTracer for the hook that is used internally.

Need to boost your app's performance?
We help React Native teams enhance speed, responsiveness, and efficiency.