Installation
npm install --save @types/use-analytics
Summary
This package contains type definitions for use-analytics (https://github.com/DavidWells/analytics/tree/master/packages/use-analytics).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/use-analytics.
import { AnalyticsInstance } from "analytics";
import * as React from "react";
export function useAnalytics(): AnalyticsInstance;
export function useTrack(): AnalyticsInstance["track"];
export function usePage(): AnalyticsInstance["page"];
export function useIdentify(): AnalyticsInstance["identify"];
export const AnalyticsContext: React.Context<AnalyticsInstance>;
export interface AnalyticsProviderProps {
children: React.ReactNode;
instance: AnalyticsInstance;
}
export const AnalyticsProvider: React.ComponentType<AnalyticsProviderProps>;
export const AnalyticsConsumer: typeof AnalyticsContext.Consumer;
export interface WithAnalyticsProps {
analytics: AnalyticsInstance;
}
export function withAnalytics<T extends WithAnalyticsProps>(
Component: React.ComponentType<T>,
): React.ComponentType<Omit<T, "analytics">>;
Additional Details
Credits
These definitions were written by Harry Cruse.