UNPKG

next-with-apollo

Version:
29 lines (28 loc) 1.63 kB
import ApolloClient from 'apollo-client'; import { AppProps, default as NextApp, DefaultAppIProps } from 'next/app'; import PropTypes from 'prop-types'; import React from 'react'; import { ApolloContext, InitApolloClient, WithApolloOptions, WithApolloProps } from './types'; export default function withApollo<TCache = any>(client: InitApolloClient<TCache>, options?: WithApolloOptions): (App: typeof NextApp) => { new (props: WithApolloProps<TCache> & AppProps<Record<string, string | string[] | undefined>> & DefaultAppIProps): { apollo: ApolloClient<TCache>; render(): JSX.Element; context: any; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<WithApolloProps<TCache> & AppProps<Record<string, string | string[] | undefined>> & DefaultAppIProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callBack?: (() => void) | undefined): void; readonly props: Readonly<{ children?: React.ReactNode; }> & Readonly<WithApolloProps<TCache> & AppProps<Record<string, string | string[] | undefined>> & DefaultAppIProps>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; }; displayName: string; propTypes: { apolloState: PropTypes.Requireable<object>; apollo: PropTypes.Requireable<object>; }; getInitialProps: (appCtx: ApolloContext<Record<string, string | string[] | undefined>>) => Promise<{}>; contextType?: React.Context<any> | undefined; };