Learn Custom Hooks In 10 Minutes

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

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

  • @brian-lau
    @brian-lau 3 ปีที่แล้ว +134

    damm, i am hooked now

  • @yanivgk
    @yanivgk 4 ปีที่แล้ว +67

    I'm usually not using custom-hooks because I lack the imagination where to use them, and video just gave me 2 great ideas, thanks ! :)
    It would be great if you could do more videos regarding different common custom-hooks like these ones.

    • @chhavimanichoubey9437
      @chhavimanichoubey9437 ปีที่แล้ว +1

      Yup, I think we don't have the coders' minds YET!!! or maybe we need to throw ourselves into the fire of a working environment to get creative and find use cases of various programming concepts.

  • @MagiCityProductions
    @MagiCityProductions 2 ปีที่แล้ว +5

    You have the best tutorials. You never add a bunch of unnecessary commentary and for that I thank you.

  • @krisnarusdiono1304
    @krisnarusdiono1304 2 ปีที่แล้ว +10

    i have finished all this react hook series in this channel, literally worth every seconds. Thanks Kyle

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז 2 ปีที่แล้ว +3

    You're really simplifying the web for me

  • @FaysalBDev
    @FaysalBDev 2 ปีที่แล้ว +2

    this video is so underrated, it should have like a billion likes. thank you

  • @wendylee5498
    @wendylee5498 3 ปีที่แล้ว +3

    It's worth taking note that the views counts for this series dropped from 216,154 views (1st video) to 42,597 views (last video), maybe means there 's a learning curve; and I am proud that I watched all and code along. Great work Kyle!!!

  • @samartajshaikh2601
    @samartajshaikh2601 2 ปีที่แล้ว +1

    The way you explain it, i am in awe of it.

  • @aubidanaalwa4161
    @aubidanaalwa4161 3 ปีที่แล้ว +2

    you are one of the best that explains, thanks a lot for all the useful information

  • @dannnnydannnn5201
    @dannnnydannnn5201 3 ปีที่แล้ว +7

    Great series. You really helped me figure out the difference between the different types of react hooks. I was not having the easiest time trying to figure it out looking through other people's code. Thanks man. Keep the videos coming. You're great at what you do!

  • @deepanjii2009
    @deepanjii2009 4 ปีที่แล้ว +7

    Wow man. You really have made the web simplified for us to build our project. Awesome content as always👏

  • @paccioti
    @paccioti 4 ปีที่แล้ว +30

    React and hooks are so freaking fun. I just got my first job as dev and first task was creating a frontend all with hooks, apollo graphql, typescrypt and redux. When you figure it out you can play around with data really nicely. PS great channel

  • @Kilopillz
    @Kilopillz 3 ปีที่แล้ว +1

    Please keep this up this is really great. I just finished your entire hooks Playlist. Thank you😊

  • @NovaMenteMedia
    @NovaMenteMedia ปีที่แล้ว +1

    Thanks so much for these videos, they are very concise and easy to follow.

  • @bohdanromanovich4912
    @bohdanromanovich4912 3 ปีที่แล้ว +1

    Your video's is awesome. It's so simple to understand what you are saying! Thank you so much!

  • @titlisarkar278
    @titlisarkar278 4 ปีที่แล้ว +1

    Thanks Kyle... These videos are really helpful for beginners.

  • @faris.abuali
    @faris.abuali 2 ปีที่แล้ว +1

    Thanks for simplifying react for us!

  • @fkbey5756
    @fkbey5756 ปีที่แล้ว

    i use redux toolkit and it helps me a lot. but really thanks for the video. we love u

  • @amiturfnd
    @amiturfnd 4 ปีที่แล้ว +2

    Thanks a lot for this video. learnt something new today :)

  • @kamelowy
    @kamelowy 2 ปีที่แล้ว +2

    useLocalStorage hook should be implemented in React by default, it makes the operations on local storage so clean i can't imagine doing it the "default" way again. Thanks for another great tutorial! :)

  • @yashdefy
    @yashdefy 2 ปีที่แล้ว

    I am "hooked" to this channel..

  • @oskarmarkin5674
    @oskarmarkin5674 4 ปีที่แล้ว +17

    TH-cam should make a two like button only for your channel because I would give you two likes

  • @madhusudhan4001
    @madhusudhan4001 4 ปีที่แล้ว

    i have three letters for this video WTF ---- hands-down best explanation of custom hooks... thanks Kyle.

  • @MaxProgramming
    @MaxProgramming 4 ปีที่แล้ว +1

    Thank you! This is very much simplified to me!

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 ปีที่แล้ว

    Great tutorial! Thank you for the explanation! 💛

  • @מיכלדרור-דשת
    @מיכלדרור-דשת ปีที่แล้ว

    best explanation ever!! thank you

  • @muhammadzeeshan07
    @muhammadzeeshan07 4 ปีที่แล้ว

    Superb kyle, every thing is clear

  • @saurabhma123
    @saurabhma123 3 ปีที่แล้ว

    Greatly explained the concept!

  • @gaatutube
    @gaatutube 3 ปีที่แล้ว

    Thanks for the great series on react hooks. Will definitely have to go through it a 2nd time to let all the details sink in. But I have good overview of it now.

  • @BeCurieUs
    @BeCurieUs 4 ปีที่แล้ว

    This example is perfect for me! I was creating a React project to manage Arkham Horror LCG stuff, and just had to saved in a big ol state. But for saving games serverlessly, local storage was gonna be the way I handled it. This idea will meld in nicely with saving my data, woot!

  • @VishalSharma-rn7mt
    @VishalSharma-rn7mt 3 ปีที่แล้ว

    Awesome explanation, genius guy

  • @rohitborra2507
    @rohitborra2507 ปีที่แล้ว

    really great tut. thanks dude

  • @liamcao-j6y
    @liamcao-j6y 2 ปีที่แล้ว

    thx already shared to Twitter

  • @krishnayele5639
    @krishnayele5639 3 ปีที่แล้ว

    liked it, loved it, just the thing I was looking for. Thanks very much.

  • @moiserwibutso4899
    @moiserwibutso4899 2 ปีที่แล้ว

    Thanks for this great tutorial.

  • @omarbarra3456
    @omarbarra3456 ปีที่แล้ว

    amazing, thanks

  • @snaplu4683
    @snaplu4683 3 ปีที่แล้ว

    great tutorial series, thank you so much

  • @thivatutorials4040
    @thivatutorials4040 11 หลายเดือนก่อน

    nice bro thanks for giving this video

  • @juliangzr4998
    @juliangzr4998 3 ปีที่แล้ว

    Thank you very much! great video

  • @arunbm123
    @arunbm123 2 ปีที่แล้ว

    very nicely explained

  • @YRS24
    @YRS24 3 ปีที่แล้ว

    awesome learnt about local storage and hooks

  • @basiccodingwithadam8125
    @basiccodingwithadam8125 3 ปีที่แล้ว

    Great little video, as usual, Kyle.

  • @l.e.nichols9382
    @l.e.nichols9382 3 ปีที่แล้ว

    This is awesome, thanks so much.

  • @SumitKumar-bu3yn
    @SumitKumar-bu3yn ปีที่แล้ว

    Thank you

  • @Neha-sw6ky
    @Neha-sw6ky 4 ปีที่แล้ว +5

    Amazing video. I'm in love with you!

  • @DeepakGupta-hj2dv
    @DeepakGupta-hj2dv 4 ปีที่แล้ว

    Great explanation kyle ..please make on one video Event loop

  • @dmcshehan
    @dmcshehan 3 ปีที่แล้ว

    Thanks a lot for the video.

  • @diegoburlandotheinformal1217
    @diegoburlandotheinformal1217 3 ปีที่แล้ว

    Good job man!

  • @ВадимАлекс-щ6ъ
    @ВадимАлекс-щ6ъ ปีที่แล้ว

    thanks!

  • @parasmaniseth7873
    @parasmaniseth7873 3 ปีที่แล้ว

    Before knowing this...I also use to the same thing....saving things in local storage....today he made this a react custom hook
    Kyle do knows how to use his tools appropriately and in efficient way

  • @ernestomotta5178
    @ernestomotta5178 4 ปีที่แล้ว

    Awesome, thank you

  • @manibarathi08
    @manibarathi08 3 ปีที่แล้ว

    You can even add a deleteItem function inside useLocalStorage to delete the item if the user needs to

  • @ajbotha7232
    @ajbotha7232 2 หลายเดือนก่อน

    Wow thanks

  • @bryceblazegamingyt9741
    @bryceblazegamingyt9741 ปีที่แล้ว

    Imagine getting hearted by one of the best teachers on the internet

  • @riyajha6500
    @riyajha6500 4 ปีที่แล้ว

    thanks, sir for such awesome video, if you possible please make some videos on react recoil.

  • @akashdevgan
    @akashdevgan 3 ปีที่แล้ว +2

    One question, why will initialValue be a function?

  • @tomermatmon
    @tomermatmon 4 ปีที่แล้ว

    This is great!

  • @OwaisAthar1
    @OwaisAthar1 2 ปีที่แล้ว

    Great ✨

  • @iurii7752
    @iurii7752 4 ปีที่แล้ว

    Great, thank you :)

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

    I ate these fucking hooks bcz of you, the great Kyle

  • @boses5320
    @boses5320 2 ปีที่แล้ว

    This was a great example... However if this example would help to stay login in after refreshing ..would be great

  • @mateokks8531
    @mateokks8531 ปีที่แล้ว

    te quiero mucho, gracias

  • @muonx9649
    @muonx9649 3 ปีที่แล้ว

    It just works!

  • @MrXperx
    @MrXperx 3 ปีที่แล้ว

    Mind blow video

  • @kikiken4287
    @kikiken4287 2 ปีที่แล้ว

    Thanks for the good video!
    But I think your useTimeout function should be like something like below.
    export function useTimeOut(callback, delay, dependency) {
    const callbackRef = useRef();
    const timeOutRef = useRef();
    useEffect(() => {
    console.log('callback update');
    callbackRef.current = callback;
    }, [...dependency]);
    ...
    }
    because like you mentioned, callback without 'useCallback' is different always.

  • @justinmlawrence
    @justinmlawrence 3 ปีที่แล้ว

    Awesome!

  • @shuuheihisagi3148
    @shuuheihisagi3148 4 ปีที่แล้ว

    Hey, thanks again for another video! Can you make on related to wherr to store jwt on the client side?

  • @rohinchopra9812
    @rohinchopra9812 3 ปีที่แล้ว

    Even though how simple the last hook was it can be pretty handy in debugging stuff

    • @priyankaroberts1093
      @priyankaroberts1093 2 ปีที่แล้ว

      Hey Rohin
      Have you been working on any react projects currently? Are you open to internship/job opportunities in software development ?

  • @ngocdangduc3772
    @ngocdangduc3772 ปีที่แล้ว +1

    Can some1 explain to me why using a function in useState can help reduce the call on localstorage ?😊

  • @rogerjohn7786
    @rogerjohn7786 4 ปีที่แล้ว

    Hi Kyle please make a video on Instant search filter like youtube on react.

  • @uprisingalpha2065
    @uprisingalpha2065 ปีที่แล้ว

    god damn good tho full skilled in this shit :D thx for ur video

  • @caesarbala
    @caesarbala 2 ปีที่แล้ว

    so custom hooks combination of function and component we take argument and return / without return . also we can useEffect within it .

  • @vinaykumar-sg7xd
    @vinaykumar-sg7xd 3 ปีที่แล้ว +2

    how can initialvalue be a function. i didn't get that part. can anyone explain please

  • @satindersingh9671
    @satindersingh9671 3 ปีที่แล้ว

    You are the best

  • @ziyadkader6767
    @ziyadkader6767 4 ปีที่แล้ว

    I am waiting for the MERN video ! :)

  • @BharatSingh-zk8lx
    @BharatSingh-zk8lx 2 ปีที่แล้ว

    this would definitely be helpful in react native
    😀

    • @priyankaroberts1093
      @priyankaroberts1093 2 ปีที่แล้ว

      Hey Bharat
      Have you built any react projects recently? Are you open to internship/job opportunities in software development ?

  • @zlackbiro
    @zlackbiro 4 ปีที่แล้ว +1

    Now, why not to bring this to another level? build your custom hook useStateStore, then create useReducer inside, import store hook into your components and voila, you have global store like Redux. Also, you can privide that store using context api... :)

  • @daniillitvinenko4348
    @daniillitvinenko4348 ปีที่แล้ว

    Can someone explain what he does starting 5:02? "And now we what we can do is use a function version...". As opposed to what? Does writing an explicit return statement make it a "function version"?

  • @ridl27
    @ridl27 4 ปีที่แล้ว

    ty.

  • @omarbarra3456
    @omarbarra3456 ปีที่แล้ว

    just a little improvement, for the the custom hook we can use named-parameters, in that way the order of the parameters does not matter.

  • @joedu7320
    @joedu7320 ปีที่แล้ว +1

    Can someone please explain: why assign a function in useState will reduce the call of localstorage, like he said in 5:20, "only call this once when first time rendering the component, not everytime render". I mean this function in useState still returns the result of function savedValue, so why not write like const [value, setValue] = useState(savedValue(key, initialValue)) ? Can anyone explain it?

    • @archdetective
      @archdetective ปีที่แล้ว +1

      I don't know if you already found your answer, but just in case...
      When using a function as initial value for useState, we need to practice "CURRYING" or wrapping function executions in another function, like this:
      useState(( ) => someFunc( ))
      as opposed to just: useState(someFunc( )).
      This way, someFunc doesn't get called unnecessarily every re-render. It's not noticeable on small apps but treat it as an optimization with the way useState hook works. In the video, the data from local storage is only read at the initial component render.
      EDIT: Try putting a console.log( ) on the function and compare. The one with no currying will show the log every keystroke.

  • @rohandevaki4349
    @rohandevaki4349 3 ปีที่แล้ว

    actually i tried the same code with a signle function , in the same component, and it works fine, but i cant use useEffect inside a function,for that i just made a if check,
    and if we want to use a useEffect inside a function, that must be a react component, or a custom hook, that is fine, but here the important thing is with a custom hook we can use it several times, instead of writing the code again and again, thanks for the awesome video,

  • @EJIqpEP
    @EJIqpEP 4 ปีที่แล้ว

    Hi Kyle, I really like your videos and the quality of the image. What camera are you using? Thanks!

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว

      It is a logitech brio shooting in 1080p

    • @EJIqpEP
      @EJIqpEP 4 ปีที่แล้ว

      @@WebDevSimplified Thanks a lot!

  • @nahida4444
    @nahida4444 2 ปีที่แล้ว

    Hey, a question, does a hook persist and share the state through multiple component, like context-provider works?

  • @SS-re8xb
    @SS-re8xb 11 หลายเดือนก่อน

    Is "if(initialValue instanceof Function) return initialValue();" necessary? Because if using a console.log() to print out whether it's true or false, we'd always get "false". So, what's the reason to use this line of code?

  • @mr-moses-01
    @mr-moses-01 2 ปีที่แล้ว +1

    Dude how are you making your hair like that every day :D

  • @willmakk
    @willmakk 4 ปีที่แล้ว

    love me some cutsom hooks

  • @sanghvian
    @sanghvian 3 ปีที่แล้ว

    legend

  • @amankaushik5833
    @amankaushik5833 4 ปีที่แล้ว

    Really, really awesome video!! as always by the way I wanted to ask that can we make android apps in like plain javascript without using React Native and can we use js with C++ or python?Thanks!!

    • @prabhatchanchal
      @prabhatchanchal 4 ปีที่แล้ว

      I know one way to use js with python is "eel" but not don't know about C++ with js.

    • @fredhair
      @fredhair 4 ปีที่แล้ว

      Android supports c++ natively and has its own NDK but why you'd want to mix it with js im not sure. PWA is basically using js and c++ just the c++ is written by the browser vendor. Its all possible but the practicality of it will depend on the kind of software you want to write.

    • @amankaushik5833
      @amankaushik5833 4 ปีที่แล้ว

      @@fredhair hey there!! actually, I was thinking that it would be easier to make a user interface if we combine c++ with js, HTML, AND CSS maybe Node js would do it.

  • @KTHoopLife
    @KTHoopLife ปีที่แล้ว

    I don't get why "useUpdateLogger" needs to use useEffect at all? Since it's prop/input parameter is constantly changing, why do you need useEffect?

  • @rohandevaki4349
    @rohandevaki4349 3 ปีที่แล้ว

    can you please create one more video , where we imlpement fetch web api in a cusom hook?

  • @Kats0unam1
    @Kats0unam1 4 ปีที่แล้ว

    Do you have a course with Hooks + Redux ?

  • @randyfix3546
    @randyfix3546 3 ปีที่แล้ว

    Why on the useEffect does React complain about ' key ' being a missing dependency? I've seen this in a couple tutorials now, has something changed with React?

  • @meowmeow21588
    @meowmeow21588 2 ปีที่แล้ว

    great video, but I don't get why the input wouldn't be persisted in the first place. Isn't the value of the input field the useState "name," whose value would persist through refreshes? So after you type something in and set the useState to that input, after a re-render why wouldn't the input just reset it value to the useState value that's still there? Thanks a ton

    • @joleDEV
      @joleDEV ปีที่แล้ว

      Because a rerender is not the same as a reload

  • @prabaljainn
    @prabaljainn 4 ปีที่แล้ว

    Sir Please make a tutorial on useSelector and useDispatch hooks

    • @alistairferns8502
      @alistairferns8502 3 ปีที่แล้ว

      useDispatch is basically mapDispatchToProps and useSelector is mapStateToProps.

  • @dali5010
    @dali5010 2 ปีที่แล้ว

    Good

  • @anasalhariri5474
    @anasalhariri5474 2 ปีที่แล้ว

    Kyle, how do you get the localstorage in chrome to update when the state is changing? I had to refresh the localstorage to see the new value. Can you please help?

  • @Pareshbpatel
    @Pareshbpatel 2 ปีที่แล้ว

    Great Tutorial on Custom Hooks in React. Thanks, Kyle
    {2022-02-24}, {2022-08-02}, {2022-11-16}, {2023-06-28}

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

    whats the configuration of your computer?

  • @PastaInformatyki
    @PastaInformatyki 4 ปีที่แล้ว +3

    In getSavedValue function: "if (savedValue) return savedValue" What if savedValue is false or 0 or an empty string? Shouldn't it be like: "if (savedValue !== null) return savedValue" or am i mistaken?