React variable problem?

Hello, bosses. We usually define react component variables in the class class. But I define variables outside of class in some code. For example,

import * as React from "react";
let acd:string;
class Abc extends React.Components{
xxxxxxx///acd
}
export default Abc;

Jul.12,2021

variables defined outside

will be shared among instances of this component


will cause global variable pollution.

Menu