Hooks are wrappers that help to encapsulate repeated stateful logic so that it can be used and shared later across multiple components. A hook is a feature that allows you to use all class-based components’ life cycle methods in functional-based. components. To create your own custom hook, React tells us to follow certain guidelines. Hooks should be called at the top of the component. We should avoid using hooks inside a condition or a loop because React will be uncertain about the order of execution of the hooks.