In 2003, noted technologist Murphy Lee presaged our current state of modular component based web applications when he asked:

Wat da hook gon be?

Though adamant that he himself had neither need nor want of hooks, many of the problems web developers face today cannot be solved simply with tracks in the background, their headphones loud and a blunt going round and they gonna rip.

Since the introduction of Hooks in late 2018, they have become a vital part of the React ecosystem, and no wonder, they’re great.

But what is a hook?

A hook can be many things.

Basic hooks provided by React allow you to use stateful logic and lifecycle functions in function components, which prior to their introduction was only available in class based components. There are hooks that allow you to chain callbacks, memoize functions and objects and communicate directly with a ref to the DOM.

And that’s only the hooks provided out of the box by React. Where hooks _really _start to shine is when you build them out. There’s a good chance that any piece of lower level logic you want to reuse can be expressed as a custom hook. The React community knows this and has created many custom hooks that you can use right now.

#components #hooks #react #draggable #react native

Create an Easy Custom React Hook for Dragging Components
1.30 GEEK