Answer the question
In order to leave comments, you need to log in
What is the meaning of react hooks?
Hello.
Now I am actively studying React, and as far as I understood, at some point, React developers made a sharp turn towards functional programming: stateless components, pure functions, and that's it. Someone directly, someone allegorically, but you can often hear that the class components are for the old people and retrogrades, and the functional ones are for the young, beautiful and politically literate. And so, having absorbed all these ideas, I came to a close study of hooks and did not understand why they are needed. Those. I want to say that exactly the same design is reproduced architecturally as it was with class components. Or am I missing something important?
I am especially confused by some code examples where they put useEffect into a pure function, a presentational component, and say: look how simple and cool, no OOP, only functional programming. Please explain why hooks are needed if there were already life cycle methods in class components before them? What question or developer problem does this innovation answer?
Answer the question
In order to leave comments, you need to log in
I am especially confused by some code examples where they put useEffect into a pure function, a presentational component, and say: look how simple and cool, no OOP, only functional programming.
Completely up to you. You can try hooks in some components without changing the code in others. Hooks don't have to be used or learned right now.
100% backward compatible. Hooks do not contain changes that could break your existing code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question