An open API service indexing awesome lists of open source software.

https://github.com/500tech/hook-cook-book

A collection of simple solution to complex problems using React Hooks
https://github.com/500tech/hook-cook-book

Last synced: 5 months ago
JSON representation

A collection of simple solution to complex problems using React Hooks

Awesome Lists containing this project

README

          

# The Hook Cook Book

Simple Patterns:
- [useState with init function](https://codesandbox.io/s/92r9yrmnyo)
- [setState with function](https://codesandbox.io/s/w6xynq3z9l)
- [Toggle reusable custom hook](https://codesandbox.io/s/zrjn39qqwx)
- [Computed values with useMemo](https://codesandbox.io/s/v80068jq40)

Advanced Patterns:
- [Resource fetching](https://codesandbox.io/s/9z4l2po0pw)
- [Easier controlled components](https://codesandbox.io/s/o97l3qzq5z)
- [Throttling with useCallback and useRef](https://codesandbox.io/s/qq8rl8lx96)
- [Custom hook for objects using lodash](https://codesandbox.io/s/v618v21x5y)
- [useReducer with action creators](https://codesandbox.io/s/rrryqpwovq)
- [useState complex object with actions](https://codesandbox.io/s/61qw22lp3z)
- [Making setInterval declarative (Dan Abramov)](https://codesandbox.io/s/105x531vkq)
- [Composing setters](https://codesandbox.io/s/composing-state-setters-g6kmq)

Complex UI problems:
- [Virtual scroll](https://codesandbox.io/s/214p1911yn)
- [Drag and Drop](https://codesandbox.io/s/v3x74022j5)
- [Scroll tracking with a reusable custom hook](https://codesandbox.io/s/r5r7w0697q)

Pitfalls:
- [Stale state with useCallback](https://codesandbox.io/s/p55wln789x)

Under the hood:
- [Order of effects, layout effects, and renders](https://codesandbox.io/s/rj6m9w531p)


### Contribute

Submit a PR to contribute more examples. Please follow the same format