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

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 7

  • @DanRNLab
    @DanRNLab  7 месяцев назад

    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 5 месяцев назад

    Thank you for the video!!

    • @DanRNLab
      @DanRNLab  5 месяцев назад

      Happy you enjoyed it!!!

  • @r_alisher
    @r_alisher 7 месяцев назад

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

    • @DanRNLab
      @DanRNLab  7 месяцев назад +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  7 месяцев назад

      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 7 месяцев назад

      thank you for information@@DanRNLab