Error ‘Cannot read properties of undefined (reading ‘pushEvent’)’ in Custom Visualizations Grafana

I get the error Cannot read properties of undefined (reading ‘pushEvent’) when I create custom visualizations, please tell me how to fix it.
screenshot error

I get this error when I use the useBlinkingCells custom hook.

Here is a sample code:

import React from 'react';
import { DataFrame, PanelProps } from '@grafana/data';
import { SimpleOptions } from 'types';
import { useBlinkingCells } from 'hooks'; // custom hook

interface Props extends PanelProps<SimpleOptions> {}

export const TablePanel: React.FC<Props> = (props) => {
    ...
   const { blinkingCells } = useBlinkingCells(
    args
   );

    ...
}
export const useBlinkingCells = (
  props
) => {
  const [blinkingCells, setBlinkingCells] = useState({});
  ...
  return {blinkingCells}
}

When I remove the useBlinkingCells custom hook the error goes away, but I need the hook to work.

Thanks in advance!