Currently, I am working with Typescript 2.8
This is the code snippet that I have:
class Wizard extends React.Componenet {
private divElement: null | HTMLDivElement = null;
componentDidUpdate(_: IWizardProps, prevState: IWizardState) {
if (this.divElement) {
this.getOverflowParent(this.divElement).scrollTop = 0;
}
}
}
I have added an if
statement to avoid potential null
values, but the compiler error persists, mentioning a possibility of it being null
. Can anyone provide guidance on this issue?