0

I'm making a new react app and this happened with me for the first time. I am using class-based components for now. I was initializing a variable in this.state inside the constructor and caught up with this weird issue.

Issue :Strike Through on super keyword.
like this : super
Please Check the Screenshot Below.

Note: No errors in the console or terminal

What could be the reason behind it & what is the solution ?

enter image description here

Sarthak Kuchhal
  • 340
  • 2
  • 11
  • Does this answer your question? [What does calling super() in a React constructor do?](https://stackoverflow.com/questions/40433463/what-does-calling-super-in-a-react-constructor-do) – evolutionxbox Sep 16 '20 at 21:19
  • Not really, I have checked this question already. I want to know why is this happening. Its not happening with another project of mine which made a few weeks back. – Sarthak Kuchhal Sep 16 '20 at 21:21
  • 1
    I think this is a bug/issue w/ either Typescript or DefinitelyTyped: https://github.com/microsoft/TypeScript/issues/40511 – coreyward Sep 16 '20 at 21:21
  • 1
    The link has many answers. One says "super is not needed in react classes". What if you hover the keyword in vscode? – evolutionxbox Sep 16 '20 at 21:21
  • (the strikethrough in VSCode indicates that the behavior is documented as being deprecated) – coreyward Sep 16 '20 at 21:23
  • Just saw that. It says deprecated. https://prnt.sc/uijufk. But how to resolve it now ? – Sarthak Kuchhal Sep 16 '20 at 21:23

0 Answers0