Exercises: Custom Hooks - React In Depth

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

КОМЕНТАРІ • 17

  • @PatrickBateman_speaks
    @PatrickBateman_speaks Рік тому +2

    Hats off to your consistency!!

  • @Haydarnt8
    @Haydarnt8 Рік тому

    nice job 👊🏿

  • @aliajellu
    @aliajellu 2 місяці тому

    Thanks a lot @TechWithNader!
    Regarding Ex 2, I found a simpler solution which seems to work. Are there any problems with this approach?
    const [state, setState] = useState(initialState)
    function setStateWithLogging(newState) {
    let resultingState
    resultingState = typeof newState === "function" ? newState(state) : newState
    setState(resultingState)
    console.log("state has changed from " + state + " to " + resultingState)
    }
    return [state, setStateWithLogging]

  • @ruskasielu6261
    @ruskasielu6261 8 місяців тому

    I would like if you could show us the result you expect at the beginning of each exercice (not the code, just the app). Sometimes I'm not sure of what we are supposed to do until I see the solution, and I realise I could have done it alone if I had known.
    Besides that, absolutely stellar content, the best react course I've seen online !

    • @TechWithNader
      @TechWithNader  8 місяців тому

      Thanks for the recommendation! I'll try to find a way to incorporate this in future videos 😃

    • @ruskasielu6261
      @ruskasielu6261 8 місяців тому

      @@TechWithNader great to hear ! Also are you planning to do other JS-related courses like Express or typescript at some point?

    • @TechWithNader
      @TechWithNader  8 місяців тому +1

      @@ruskasielu6261 I have the REST API course in progress right now using Deno (TS/JS) 🦕

    • @ruskasielu6261
      @ruskasielu6261 8 місяців тому

      @@TechWithNader i did see it, but I was a bit confused when it comes to the choice of deno instead of Node (as it's a lot more popular). Will any of these skills transfer to regular Nodejs?

    • @TechWithNader
      @TechWithNader  8 місяців тому +1

      @@ruskasielu6261 Yup! I chose Deno because it uses all the standard Web APIs and they transfer to anything that uses them 😊 Also the main concepts apply to any style of rest like API 🥳

  • @brajagopalmukherjee1588
    @brajagopalmukherjee1588 Рік тому

    Fire 🔥

  • @giafra95
    @giafra95 11 місяців тому

    Hello @TechWithNader , many thanks for the extremely helpful video.
    I got a question for you regarding Exercise 3 (useQuery custom hook): isn't it a React anti-pattern to fetch outside of a useEffect hook? I'm referring to the function fetcher you coded. Technically, the network request as you coded the hook is not placed inside a useEffect hook. Should this be a point of concern ?
    Thanks again.

    • @TechWithNader
      @TechWithNader  11 місяців тому

      Great question! You are correct that you should generally not fetch data outside a use effect (since it’s a side effect). In this case we still abide by that rule since inside the hook the fetch code is contained inside the use effect. It just looks like we are using it outside in the component we are using the hook in, but picture copying and pasting the hook code and you’ll see it’s still all contained in the effect and state calls as you’d expect 😊
      Hope that makes sense!

  • @shehanmaduwantha4795
    @shehanmaduwantha4795 Рік тому

  • @lowellbowers8328
    @lowellbowers8328 Рік тому

    'Promosm' 🎉