TrackedSection
Generates a <section>
Element wrapped in a ContentContext.
TrackedSection: (props: {
objectiv?: {
id?: string,
normalizeId?: boolean,
}
}) => <section>
objectiv
prop attributes
type | default value | ||
---|---|---|---|
optional | id | string | inferred from native id or title |
optional | normalizeId | boolean | true |
info
- When the
id
attribute is omitted, we attempt to infer it from one of the elements' native props:id
ortitle
.
If that fails, an error will be logged to the Developer Console and the original Component is rendered.
Returns
<section>
Automatic Events
None.
Usage example
import { TrackedSection } from '@objectiv/tracker-react';
<TrackedSection id={'content'}>
...
<TrackedSection objectiv={{ id: 'sub-section' }}>
...
</TrackedSection>
</TrackedSection>
By default, all Tracked Elements automatically normalize their Context identifiers to a kebab-cased format.
This can be disabled via the normalizeId
option:
import { TrackedSection } from '@objectiv/tracker-react';
<div>
<TrackedSection id={'Another Section'} objectiv={{ normalizeId: false }}>
...
</TrackedSection>
<TrackedSection objectiv={{ id: 'do not normalize', normalizeId: false }}>
...
</TrackedSection>
</div>
Did you know ?
TrackedSection
internally uses TrackedContentContext.