You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I scanned the code with SonarCloud and discovered this pattern is often used:
const hasError = error && error !== null;
I found it complicated to understand and I believe the code is not doing what you expect, especially when error is null or undefined.
I think the code could be change to:
const hasError = !!error;
or const hasError = Boolean(error);
Hello,
I scanned the code with SonarCloud and discovered this pattern is often used:
const hasError = error && error !== null;
I found it complicated to understand and I believe the code is not doing what you expect, especially when
error
is null or undefined.I think the code could be change to:
const hasError = !!error;
or
const hasError = Boolean(error);
Reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean#:~:text=Do%20not%20use%20a%20Boolean
Reproducer:
The text was updated successfully, but these errors were encountered: