3 ms·
One way or another it's fine to consider methods that explicitly use state as 'not functions'. This is the mathematical definition after all. That definition l
by contravariant 7y ago
One way or another it's fine to consider methods that explicitly use state as 'not functions'. This is the mathematical definition after all.
That definition leads to the conclusion that hooks aren't functions, which seems fine honestly. I mean, why insist on using them as functions when they're clearly not? Their syntax is a bit unfortunate, as is the fact that you're not forced to declare them immediately at the start of your function, which looks like it would have cleared up many of the potential problems. Either way their use case is clear, using hooks seems to basically dynamically declare a state monad for that particular function (hence why I'd recommend doing this upfront).
I'm not a React programmer though, so take this with a grain of salt.