I have been writing OO code in Java for nearly three decades, I have been writing functional code for about three months now so excuse me if this sounds like I'm just ignorant of a few things. My first question is, isn't it functional programming's goal to not maintain state information between method calls? Second is, if you combine this with TypeScript, don't you now just have plain ol' Java again?
Yes, in general functional programming styles tend towards stateless code and immutable data.
React hooks are constructed specifically to access and change stateful information in the context of a functional component. There are ways to solve this issue using stateless functional programming practices, but I don't think it's the react team's goal to enforce any particular programming style. Thus, hooks are a pragmatic solution.
Does this help at all?
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.