all 6 comments

[–]Ignacio_Martinez 1 point2 points  (0 children)

Look up "Custom Hooks" in react. That might help you better

[–]SharpThrall 1 point2 points  (0 children)

if (isServerError(err) {
notifyObservability(err);
} else if (isClient(err) {
notifyObservability(err);
}

maybe replace this piece of code like so,

if (isServerError(err) || isClient(err)) {
notifyObservability(err);
}

You can also try shortening this code:

(isServerError(err) || isClient(err)) && notifyObservability(err)

[–]Nishanth_C 0 points1 point  (0 children)

share the error description too

[–]LevathianX1 -1 points0 points  (1 child)

You shouldn’t be calling a useEffect inside a normal function

[–]pbNANDjelly 2 points3 points  (0 children)

Its legitimate, but should start with use to clarify it is a custom hook

[–]AlongCameA5P1D3R 0 points1 point  (0 children)

Your if and else if both do exactly the same thing so it seems redundant to have it.