export default class Printer extends React.PureComponent<PrinterProps> {
static contextType = PrinterContext;
constructor(props: PrinterProps, context: PrinterInterface){
super(props, context);
this.PrinterInfo = getPrinterInfo(this.context);
}
I need to pass context to super to be able to access it within the constructor.
Passing of context to constructor is not there in their latest documentation -
https://reactjs.org/docs/context.html
but it is there in the legacy api documentation.
https://reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods
Since passing context to super will be deprecated in versions 17 and above, what is a way to be able to accees context within passing it to super in constructor ?
Thanks!