How to use the next-server/dist/lib/utils.getDisplayName function in next-server

To help you get started, we’ve selected a few next-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kunalgorithm / graphql-fullstack / components / apollo / with-apollo.js View on Github external
const withApollo = PageComponent => {
  return class extends React.Component {
    static displayName = `withApollo(${getDisplayName(PageComponent)})`;

    static async getInitialProps(ctx) {
      const { AppTree } = ctx;

      let pageProps = {};
      if (PageComponent.getInitialProps) {
        pageProps = await PageComponent.getInitialProps(ctx);
      }

      // Run all GraphQL queries in the component tree
      // and extract the resulting data
      const apolloClient = initApollo(
        {},
        {
          getToken: () => parseCookies(ctx.req).token,
        }
github zeit / next.js / packages / next / client / with-router.js View on Github external
export default function withRouter (ComposedComponent) {
  const displayName = getDisplayName(ComposedComponent)

  function WithRouteWrapper (props) {
    return (
      <RouterContext.Consumer>
        {router => (
          <ComposedComponent
            router={router}
            {...props}
          />
        )}
      </RouterContext.Consumer>
    )
  }

  WithRouteWrapper.displayName = `withRouter(${displayName})`