This interesting thing came up with one of our libraries that a colleague found out when he got stuck. I am just here to amplify and talk about it. The Problem: The issue was related to the server-side rendering of a react application. When attempting to render a page on the server side, one of our internal libraries kept giving a "not defined" error on the window object causing a failure in the server-side rendering of a page. This was the code that caused the "not defined" error: Now, before getting into what's wrong with the above code, we need to understand the difference between "undefined" and "not defined" in Javascript. "undefined" vs "not defined" When a variable is declared but is not initialised to any value, then by default it holds "undefined" as the value. This "undefined" is one of the primitive data types in Javascript that is used as a default value for a declared but not initialised va...
Quick tips gained through my experiences at work