Apollo Client (3) in Next.js (10) with TypeScript & GraphQL Code Generator

Поділитися
Вставка
  • Опубліковано 19 лис 2024

КОМЕНТАРІ • 31

  • @stevenz1276
    @stevenz1276 3 роки тому +5

    The quality of your videos is at another level. Appreciate it! Specifically your approach to tell the story: first briefly describe what we are going implement, then you show the result of each small step instead typing line by line, and your explaination has enough details to understand the code.
    I wonder if you could do another video, based on this existing code, to show how to add authentication using NextAuth, and how to login using JWT. That would be great!

    • @TomDoesTech
      @TomDoesTech  3 роки тому +1

      Thank you so much, that is the single best compliment I have ever received :)
      I have done a video on username & password auth with GraphQL NestJS but I suppose I could build on this tutorial and do the UI for that.
      I'm not familiar with NextAuth so I will look into that.

    • @stevenz1276
      @stevenz1276 3 роки тому

      I have a question regarding the `headers` in `nextWithApollo`, how can we pass the values(like a JWT token) to `headers` ?

    • @TomDoesTech
      @TomDoesTech  3 роки тому +1

      @@stevenz1276 Good question, you can see an example of that here: github.com/tomanagle/NextJS-NestJS-GraphQL-Starter/blob/master/client/lib/withApollo.tsx#L24

  • @nikolam-dev
    @nikolam-dev 3 роки тому +2

    Thanks for your videos, I learn a lot to improve my architecture

    • @TomDoesTech
      @TomDoesTech  3 роки тому +1

      Thank you :) Please let me know what other tutorials you would like me to do.

    • @nikolam-dev
      @nikolam-dev 3 роки тому

      @@TomDoesTech As you are going this is perfect, I have searched a lot for this kind of content in Spanish and even English and just a few days ago I came across this gem of a channel.

  • @Zyphire
    @Zyphire 3 роки тому

    Thank you! I was missing 'getDataFromTree'

  • @alexzamora9843
    @alexzamora9843 3 роки тому +1

    Excelent video, Thanks for your effort

  • @jocelynhuang8831
    @jocelynhuang8831 3 роки тому +1

    This tut is soooo cool and helpful, thanks a lot!

  • @felipemiotto5409
    @felipemiotto5409 Рік тому +1

    Thanks man!

  • @bartoszjaniuk7681
    @bartoszjaniuk7681 2 роки тому +4

    On 7:00 i'm getting this error: "React Hook "useRouter" is called in function "render" that is neither a React function component nor a custom React Hook function." How i can fix that?

  • @fahimshahriarsawon9164
    @fahimshahriarsawon9164 3 роки тому +1

    alhamdulillah, understand it greatly

  • @scotttang6229
    @scotttang6229 3 роки тому

    Thank you for the tutorial. This is very helpful.

  • @sumitgovil2311
    @sumitgovil2311 3 роки тому +1

    Excellent video. I wonder will I be able to generate paths using these generated hooks anyhow?

    • @TomDoesTech
      @TomDoesTech  3 роки тому

      What do you mean by generate paths?

    • @sumitgovil2311
      @sumitgovil2311 3 роки тому

      @@TomDoesTech So you know how you do getStaticPaths and execute query inside that, so it generates pages for every slug! Is that possible with this setup? Ideally I would have used Apollo client and fired a query inside getStaticPaths, but that won't let me use the power of codegen w.r.t. generated hooks. I want to keep the pattern consistent in my project, so want to use hooks for fetching data everywhere. Hope my question is making sense. :)

    • @TomDoesTech
      @TomDoesTech  3 роки тому

      @@sumitgovil2311 okay yeah, I get what you're asking now. You can't use hooks outside of a React component, so you can't use hooks in getStaticPaths. However, hooks aren't the only way to query a GQL API and hooks aren't the only thing that graphql-code-generator can output. I'm not sure exactly what the answer is but I think it will be something like `client.query(generated_query)`

    • @sumitgovil2311
      @sumitgovil2311 3 роки тому

      @@TomDoesTech ​

    • @TomDoesTech
      @TomDoesTech  3 роки тому

      @@sumitgovil2311 ?

  • @1995sharaku
    @1995sharaku 2 роки тому

    Hey, I have one question. What is the advantage of not using getserversideprops function for ssr and instead use it this way ?

    • @TomDoesTech
      @TomDoesTech  2 роки тому

      You can't use hooks in getserversideprops

  • @brahimo4701
    @brahimo4701 2 роки тому

    What if we want to access req and res from context wich exist in context of getServerSideProps?

  • @guilhermecandidocruz
    @guilhermecandidocruz 3 роки тому

    How can i spy and test my query/mutations calls ??? Didnt work