0

the regular functions or arrow functions both support "this" keyword, it is okay. But In react official documentation it is written that functional components have no 'this'. As I know, react functional components are same as normal functions and react doesn't identity which are regular functions and which are components when we write a functional component, so what does it mean that functions support 'this' but functional component don't.

  • 1
    Arrow functions do [not](https://stackoverflow.com/questions/28798330/arrow-functions-and-this) support this. That's one of the points of having them. Its usually used to allow the this from the outer scope to be used without ambiguity. – Paul Rooney May 27 '21 at 09:23
  • React is JavaScript. It's useful to remember that what you call a "React functional component" is just a function. How you define that function determines what `this` is. – Andy May 27 '21 at 09:31

1 Answers1

-1

In react function components you can use the state hook instead of using "this". Here is the react documentation on the state hook. https://reactjs.org/docs/hooks-state.html