These errors occur on login (I used the ‘Login with Facebook’ button) at:
/src/components/TopNav.js:69
/src/components/TopNav.js:100
/src/components/TopNav.js:134
/src/components/MobileNav.js:75
These occur because the user object is not yet built on page load.
Later errors don’t show until preceding error is corrected.
Errors corrected using the following technique to check if object properties exist thru multiple levels:
(((testObject || {}).level1 || {}).level2 || {}).level3
It should be the most syntactically concise and computationally efficient way to do this.
Read more at: https://stackoverflow.com/a/4034468/7482353
2) Remove Unnecessary Ternary
Removed the unnecessary lengthly ternary check at /src/components/TopNav.js:100
because [].length is falsey.
3) Set Dev ENV Variable for Babel
Added process.env.BABEL_ENV = 'development';
to /scripts/start.js as it was preventing me from running the app locally.
According to the error, setting NODE_ENV should suffice, but it doesn't.
1) Correct Login Errors
These errors occur on login (I used the ‘Login with Facebook’ button) at: /src/components/TopNav.js:69 /src/components/TopNav.js:100 /src/components/TopNav.js:134 /src/components/MobileNav.js:75
These occur because the user object is not yet built on page load. Later errors don’t show until preceding error is corrected.
Errors corrected using the following technique to check if object properties exist thru multiple levels:
(((testObject || {}).level1 || {}).level2 || {}).level3
It should be the most syntactically concise and computationally efficient way to do this. Read more at: https://stackoverflow.com/a/4034468/74823532) Remove Unnecessary Ternary
Removed the unnecessary lengthly ternary check at /src/components/TopNav.js:100 because
[].length
is falsey.3) Set Dev ENV Variable for Babel
Added
process.env.BABEL_ENV = 'development';
to /scripts/start.js as it was preventing me from running the app locally. According to the error, setting NODE_ENV should suffice, but it doesn't.