Getting Started with Expo (React Native), TypeScript and GraphQL for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ธ.ค. 2024

ความคิดเห็น • 7

  • @DanRNLab
    @DanRNLab  9 หลายเดือนก่อน

    I forgot to include this in the video, but when you run codegen you can also generate the hooks with the query names. Some developers prefer this. I don't do this here because I prefer to wrap the hook anyway.
    If you would like to investigate further you can check out more here:
    the-guild.dev/graphql/codegen/plugins/typescript/typescript-react-apollo#withhooks

  • @ronnycoding
    @ronnycoding 7 หลายเดือนก่อน

    Thank you for the video!!

    • @DanRNLab
      @DanRNLab  7 หลายเดือนก่อน

      Happy you enjoyed it!!!

  • @r_alisher
    @r_alisher 9 หลายเดือนก่อน

    why do you create custom react hooks? this library generates its own hooks or it is not the best practise ?

    • @DanRNLab
      @DanRNLab  9 หลายเดือนก่อน +1

      In my case it is an ease of use thing. You don't always want to use the data as-is. I created helpers here in order to make the hooks easier to call from the component that consumes the data.
      If you generate the hooks you still have to pass in the same data as if you used useMutation, useQuery etc.
      You can see this in createNewTodo for example where I wrap createTodo so that the ID is passed in every time. Both ways are equally valid. Its more of a preference thing

    • @DanRNLab
      @DanRNLab  9 หลายเดือนก่อน

      Thanks for adding this detail @r_alisher. I pinned a comment about it in case others don’t want to wrap their hooks and use the codegen ones.

    • @r_alisher
      @r_alisher 9 หลายเดือนก่อน

      thank you for information@@DanRNLab