Getting ref null inside useCallback hook

I’m trying to set the value of input using ref but I’m getting ref null inside useCallback Hook.

let inputRef = useRef();
const search = useCallback(
        (data) => {
            console.log(inputRef);
        },
        [inputRef],
    );

return <input type="text" ref={inputRef} />

and It’s showing null in the browser console when I call this function.

this is just an example showing, what I’m trying to achieve.

134 thoughts on “Getting ref null inside useCallback hook”

  1. Pingback: keto green diet
  2. I just could not depart your website prior to suggesting that I extremely enjoyed the standard information a person provide for your guests? Is going to be back steadily in order to investigate cross-check new posts.

    Reply
  3. May I simply just say what a comfort to find someone who actually understands what they’re
    talking about online. You definitely understand how to bring an issue
    to light and make it important. More people really need to look at this and understand this side of your
    story. I can’t believe you’re not more popular given that you definitely possess the gift.

    Reply
  4. wonderful points altogether, you simply gained a brand new reader.

    What might you suggest in regards to your post that you just made some
    days ago? Any positive?

    Reply
  5. You really make it seem so easy together with your presentation however I to find this matter to be really one thing that I feel I might never understand.

    It sort of feels too complex and very vast for me.
    I’m having a look forward for your subsequent publish, I will try to get the hang of it!

    Reply
  6. Thanks for the marvelous posting! I seriously enjoyed
    reading it, you are a great author. I will ensure that I bookmark your blog and may come back very soon. I want to encourage you to continue
    your great work, have a nice evening!

    Reply
  7. I must thank you for the efforts you have put in writing this blog.

    I really hope to view the same high-grade content from you later
    on as well. In truth, your creative writing abilities has motivated me to get my own, personal blog now ;
    )

    Reply
  8. Good day I am so excited I found your webpage, I really found you by error, while I was looking
    on Digg for something else, Anyhow I am here now
    and would just like to say many thanks for a marvelous post and a all round entertaining blog (I also love
    the theme/design), I don’t have time to look over it all at the minute but I
    have saved it and also added in your RSS feeds, so when I have time I
    will be back to read a lot more, Please do keep up the fantastic job.
    asmr https://app.gumroad.com/asmr2021/p/best-asmr-online asmr

    Reply
  9. You really make it seem so easy together with your presentation however I to find this topic to be actually something which I believe I’d by no means understand. It kind of feels too complicated and very broad for me. I am having a look ahead for your subsequent submit, I’ll attempt to get the hold of it!

    Reply
  10. Can I simply just say what a relief to find someone that genuinely understands
    what they’re talking about over the internet. You certainly realize
    how to bring a problem to light and make it important.

    A lot more people really need to look at this and understand this side of your story.

    I was surprised you’re not more popular because you definitely possess the gift.

    scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

    Reply
  11. You hold an one-of-a-kind aptitude. Your website writing competences are simply outstanding. Thanks for sending web content via the internet and informing your followers.

    Reply
  12. you are really a good webmaster. The web site loading speed is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterpiece. you’ve done a fantastic job on this topic!

    Reply