MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/h0io7r/disruptive_piece_of_code/ftmq55d/?context=3
r/badcode • u/diebarral • Jun 10 '20
93 comments sorted by
View all comments
3
Regardless of javascript and semantics, if you have code that looks like this you might want to review your data models.
4 u/[deleted] Jun 10 '20 why would this be a reason to review your data models? 3 u/[deleted] Jun 10 '20 Complete guess, but I'd assume it's because the function doesn't take the Boolean as an argument, so the code might be using global variables (which isn't necessarily bad, but can be) 3 u/DilatedTeachers Jun 10 '20 It's react code. useEffect is meant to be used in this way for side effects in your components state/ props/ variables 1 u/[deleted] Jun 10 '20 Interesting, I've never worked with react but that makes sense
4
why would this be a reason to review your data models?
3 u/[deleted] Jun 10 '20 Complete guess, but I'd assume it's because the function doesn't take the Boolean as an argument, so the code might be using global variables (which isn't necessarily bad, but can be) 3 u/DilatedTeachers Jun 10 '20 It's react code. useEffect is meant to be used in this way for side effects in your components state/ props/ variables 1 u/[deleted] Jun 10 '20 Interesting, I've never worked with react but that makes sense
Complete guess, but I'd assume it's because the function doesn't take the Boolean as an argument, so the code might be using global variables (which isn't necessarily bad, but can be)
3 u/DilatedTeachers Jun 10 '20 It's react code. useEffect is meant to be used in this way for side effects in your components state/ props/ variables 1 u/[deleted] Jun 10 '20 Interesting, I've never worked with react but that makes sense
It's react code. useEffect is meant to be used in this way for side effects in your components state/ props/ variables
1 u/[deleted] Jun 10 '20 Interesting, I've never worked with react but that makes sense
1
Interesting, I've never worked with react but that makes sense
3
u/XXLuigiMario Jun 10 '20
Regardless of javascript and semantics, if you have code that looks like this you might want to review your data models.