3 ms·
This is not really embarrassing code relatively speaking. Start replacing the global variables with ‘const one = useState(1)’, and get a few of those DOM eleme
by runawaybottle 6y ago
This is not really embarrassing code relatively speaking.
Start replacing the global variables with ‘const one = useState(1)’, and get a few of those DOM elements into a render function, and it’ll start to look like what most front end people write now days. Split the helper/utility methods out to a helpers.js file, import in the ones you need. Swap out the Date and Number handling with native methods or decent library.
I’d call this person crazy if he abstracted into something
wholesale unnecessary like a state machine or a pub/sub pattern, or factory pattern, etc.
So far so good, plenty to work with here. The person was not given any bad ideas to even contemplate writing it in anything but a straightforward way.