React native context and deprecated super usage

前端 未结 1 1303
野趣味
野趣味 2020-12-19 14:07

I\'ve been away from react native programming for a week and when I got back, after some VSCode updates, I have noticed that many of my super(props) calls in cl

相关标签:
1条回答
  • 2020-12-19 14:34

    After looking further into this, it seems that my knowledge of the use of super() and super(props) is correct. The issue I am experiencing with super(props) being marked as deprecated is due to an erroneous deprecation marking in React's TS definitions.

    What should've been marked as deprecated was the overloaded form of super, super(props, context), which takes a context prop used by React's legacy context API.

    The issue is better described and discussed at this (currently open) issue on Microsoft's TypeScript github page: https://github.com/microsoft/TypeScript/issues/40511

    Until the issue is fixed, the deprecation warning can be safely ignored.

    0 讨论(0)
提交回复
热议问题