DEV Community

Discussion on: Why I almost always`useMemo` and `useCallback` 🤯

Collapse
 
iegik profile image
Arturs Jansons

The below is an example of a hook we which keeps the same functionality but changes it's implementation.

  • bad example, where functionality is changes too. The better will be:
const useArrayToObject = (array) => ({ [array[array.length]]: true })
Enter fullscreen mode Exit fullscreen mode