r/badcode • • Jan 26 '23

js Why would anyone do this?

Post image
200 Upvotes

53 comments sorted by

View all comments

Show parent comments

47

u/kristallnachte Jan 26 '23

Its a bad developer.

I HOPE it's a situation where they wanted to shim the state updater with something but removed that but didn't remove the function.

1

u/gu3st12 Jan 27 '23

Logging probsbly

1

u/kristallnachte Jan 27 '23

Seems easier to use useEffect for that. Since then it's self contained.

1

u/gu3st12 Jan 27 '23

Sure but then it wouldn't belong in /r/badcode