I am trying to reduce the function cognitive complexity required by SonarQube, I am wondering, are these two if statements equivalent?
The first statement:
if (
currentRef &&
currentRef.current &&
currentRef.current.value.length === 0
)
I want to replace it by :
if (
currentRef?.current?.value.length === 0
)