12345678910111213141516 |
- import {useContext} from 'react';
- import {
- FlamegraphState,
- FlamegraphStateValueContext,
- } from '../flamegraphStateProvider/flamegraphContext';
- export function useFlamegraphSearch(): FlamegraphState['search'] {
- const context = useContext(FlamegraphStateValueContext);
- if (context === null) {
- throw new Error('useFlamegraphSearch called outside of FlamegraphStateProvider');
- }
- return context[0].search;
- }
|