PitchKit
API Reference@pitchkit/reactFunctions

useGoalView()

function useGoalView(): GoalViewContextValue;

Defined in: packages/react/src/goal-view-context.ts:46

The view's frame, layout and coordinate mapping: the <GoalView> counterpart to usePitch(). For anything <GoalShots> doesn't draw, such as a keeper's position or a label beside a shot.

function Keeper({ y }: { y: number }) {
  const { toPixel } = useGoalView();
  const point = toPixel(y, 0);
  return point ? <rect x={point.x - 2} y={point.y - 40} width={4} height={40} /> : null;
}

Returns

GoalViewContextValue

On this page