next-with-apollo
Version:
Apollo HOC for Next.js
13 lines (12 loc) • 715 B
TypeScript
import App from 'next/app';
import React from 'react';
import { ApolloContext, InitApolloClient, WithApolloOptions, WithApolloProps } from './types';
export default function withApollo<TCache = any>(client: InitApolloClient<TCache>, options?: WithApolloOptions): (Page: typeof App | (React.ComponentClass<any, any> & {
getInitialProps?(context: import("next").NextPageContext): any;
}) | (React.FunctionComponent<any> & {
getInitialProps?(context: import("next").NextPageContext): any;
}), pageOptions?: WithApolloOptions) => {
({ apollo, apolloState, router, ...props }: Partial<WithApolloProps<TCache>>): any;
displayName: string;
getInitialProps(pageCtx: ApolloContext<any>): Promise<{}>;
};