
Brian E. answered 03/27/19
Senior Full Stack JavaScript Developer (Node & React)
The problem here is with if (User =! null). "!" is the NOT operator. It will return the opposite of what you give it. "=" is the assignment operator. It sets something equal to something else. In the order you have it, you're setting "User" equal to the opposite of null - which is true. To prove that, check the value of "User" after that line.
You'll want to use "!=" or "!==" (do some research on the difference). These read as "not equal to".