When I use this.context in a class I see a warning "Deprecated symbol used, consult docs for better alternative" in PhpStorm IDE.. it is really deprecated?
"react": "16.8.3"
I'm experiencing same issue in Webstorm.
It's not deprecated (according to latest React docs) but I think It's referring to the legacy Context API, so that's why.
Please report this to PhpStorm/WebStorm. This is a mistake because this.context can be a modern API. Only childContextTypes, getChildContext() and contextTypes (NOT contextType) are getting deprecated.
cc @prigara
Hi,
It seems to be marked as deprecated in the type definition file for React we are using. Will check if the problem is on the IDE side or on the .d.ts file. Thanks for the feedback.
Webstorm should work fine as of 2019.2 version.
In the index.d.ts file we see the @deprecated marking with some notes on how to override it"

/**
* If using the new style context, re-declare this in your class to be the
* `React.ContextType` of your `static contextType`.
*
* ```ts
* static contextType = MyContext
* context!: React.ContextType<typeof MyContext>
* ```
*
* @deprecated if used without a type annotation, or without static contextType
* @see https://reactjs.org/docs/legacy-context.html
*/

TLDR according to the helpful notes just make sure to declare as:
context!: React.ContextType<typeof AppContext>;
Hey @PathToLife!
Do you know how to fix deprecated highlighting if the file does use plain JS only?
Seconded @VitalyKrenel
How do we fix this for plain JS?
Hi,
It seems to be marked as deprecated in the type definition file for React we are using. Will check if the problem is on the IDE side or on the .d.ts file. Thanks for the feedback.
any update?
Hi all, I've sent a PR to the DefinitelyTyped repo to remove the deprecation warning: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/39177
@prigara , The deprecated warning is still seen and we are on webstorm 2020.1
Most helpful comment
Hi,
It seems to be marked as deprecated in the type definition file for React we are using. Will check if the problem is on the IDE side or on the .d.ts file. Thanks for the feedback.