Hooks are a way of sharing reusable behavior in React. They pair with components which are a way of sharing reusable visuals. A good example of why you would need hooks is the React Spring library. react-spring.io/docs/hooks/use-spring which provides functionality to do animations.
Before hooks came out the solution to sharing functionality like this was either.
1) Higher Order components
2) render props
Neither solution is ideal because they create extra components, make Server Side rendering harder, and make it hard to combine behaviors.
For instance if you wanted to control an animation via a websocket you could use react-spring and react-use-websockets together.
Hooks are a way of sharing reusable behavior in React. They pair with components which are a way of sharing reusable visuals. A good example of why you would need hooks is the React Spring library. react-spring.io/docs/hooks/use-spring which provides functionality to do animations.
Before hooks came out the solution to sharing functionality like this was either.
1) Higher Order components
2) render props
Neither solution is ideal because they create extra components, make Server Side rendering harder, and make it hard to combine behaviors.
For instance if you wanted to control an animation via a websocket you could use react-spring and react-use-websockets together.
Wow! What a great way to describe this, you get two high fives and a sticker!