r/reactjs • • Feb 23 '20

Needs Help Beginner requesting a code review and advice

[deleted] — view deleted post

45 Upvotes

25 comments sorted by

View all comments

Show parent comment

6

u/[deleted] Feb 23 '20

If you have one variable it can be state === 'LOADING' or state === 'ERROR', never both. With two booleans you could have loading === true and error === true which could potentially be problematic.

0

u/[deleted] Feb 24 '20

[deleted] — view deleted comment

2

u/exia_00_qant Feb 24 '20

Calling the function in jsx is perfectly valid

0

u/[deleted] Feb 24 '20

[deleted] — view deleted comment

2

u/exia_00_qant Feb 24 '20

Also this is semantic more than anything, you might want to rename your variable to displaytext or getDisplayText or something along those lines.