My React Native app is throwing "maximum call stack exceeded" error and as I troubleshoot the issue, I'm beginning to think my util functions may be causing the issue.
My background is OOP and I always try to create centralized util functions that I can call from anywhere in my app. In my RN app, I created quite a few validation functions that validate values in different parts of the app. For example, I have isValidString(), isValidNumber(), isValidGuid() etc. functions.
Furthermore, these functions are opiniated, meaning isValidString() will return true not only when the variable is of a string type but also has a length greater than 0. I then call these functions all throughout my code.
I now begin to feel that these validation and other util functions may be causing the "maximum call stack exceeded" error because they get called a lot.
My objective with these functions is to reduce repetitive code and be consistent. My question is: Is this centralized util function approach an antipattern in JavaScript?