Why React Function Component's "this" is undefined

I tested ‘this’ variable in React’s Arrow function component.

I expected ‘this’ value may be Global variable Whenever I call function component .

Because so far as I know, ‘this’ in arrow function is bound When Arrow Function is declared and ‘this’ is determined by Lexical Scope rule.

The end of Lexical Scope is Global Scope, so ‘this’ might be Global Variable.

What I am missing for ? Thank you.

export default (props) => {

  console.log(this)

  return (
    <div>react this test</div>
  )
}

69 thoughts on “Why React Function Component's "this" is undefined”

  1. Pingback: gay dating uk
  2. Its like you read my mind! You appear to know a lot about
    this, like you wrote the book in it or something. I think that you can do
    with a few pics to drive the message home a bit, but
    instead of that, this is great blog. A great read.
    I will certainly be back.

    Reply
  3. I am now not sure the place you’re getting your information, however good topic.
    I needs to spend some time studying much more or figuring out more.
    Thank you for magnificent info I used to be
    searching for this information for my mission.

    Reply
  4. Great beat ! I would like to apprentice while you amend your web site, how
    can i subscribe for a blog web site? The account aided me a acceptable
    deal. I had been a little bit acquainted of this your broadcast offered bright clear concept

    Reply
  5. Hey very nice website!! Guy .. Excellent
    .. Wonderful .. I’ll bookmark your blog and
    take the feeds additionally? I am happy to seek out numerous useful information right
    here in the submit, we want work out more techniques on this regard, thanks for sharing.
    . . . . .

    Reply
  6. This design is wicked! You obviously know how to keep a reader
    entertained. Between your wit and your videos, I was almost moved to start
    my own blog (well, almost…HaHa!) Excellent job.
    I really loved what you had to say, and more than that, how you presented it.

    Too cool!

    Reply
  7. Hey! Someone in my Myspace group shared this website with us so I came
    to give it a look. I’m definitely enjoying the information. I’m bookmarking
    and will be tweeting this to my followers! Superb blog and
    great style and design.

    Reply
  8. This is the right blog for anyone who wishes to understand this topic.
    You know a whole lot its almost tough to argue with you (not that
    I actually will need to…HaHa). You definitely put a new spin on a topic
    which has been written about for decades. Wonderful
    stuff, just wonderful!

    Reply
  9. You’re so awesome! I do not think I have read through something like this before.
    So nice to find someone with some original thoughts on this subject matter.

    Seriously.. many thanks for starting this up.
    This website is something that’s needed on the internet, someone with a bit of originality!

    Reply
  10. I do consider all of the concepts you have offered to your post.
    They’re very convincing and can definitely work. Still, the posts are too short for beginners.
    Could you please lengthen them a bit from next time? Thanks for
    the post.

    Reply
  11. Today, I went to the beach front with my kids.
    I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell
    to her ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely
    off topic but I had to tell someone!

    Reply

Leave a Comment