useCompanyOwnershipContext
A hook that provides access to the CompanyOwnershipModel which has various functions that can be used to interact with the CompanyOwnership. It can only be used inside a CompanyOwnership component or a CompanyOwnershipProvider.
function CompanyOwnershipWrapper() {
const { fitContent, zoomTo } = useCompanyOwnershipContext()
return (
<>
<CompanyOwnership data={data} contextMenuItems={item => {
if (item) {
return [{ title: 'Zoom to Item', action: () => zoomTo([item]) }]
}
return []
}}>
</CompanyOwnership>
<div style={{position: 'absolute', top: '20px', left: '20px'}}>
<button onClick={() => fitContent()}>Fit Content</button>
</div>
</>
)
}
function CompanyOwnershipComponent () {
return (
<CompanyOwnershipProvider>
<CompanyOwnershipWrapper></CompanyOwnershipWrapper>
</CompanyOwnershipProvider>
)
}
Returns
Type | Description |
---|---|
CompanyOwnershipModel | Returns the CompanyOwnershipModel used in this context. |