All Projects β†’ dawnlabs β†’ tacklebox

dawnlabs / tacklebox

Licence: MIT license
🎣React UX components for handling common interactions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tacklebox

react-ui-hooks
🧩Simple repository of React hooks for building UI components
Stars: ✭ 20 (+33.33%)
Mutual labels:  hooks, react-hooks
flhooks
React like Hooks implementation for Flutter.
Stars: ✭ 38 (+153.33%)
Mutual labels:  hooks, react-hooks
react-use-comlink
Three ways to use Comlink web workers through React Hooks (and in a typesafe manner).
Stars: ✭ 39 (+160%)
Mutual labels:  hooks, react-hooks
Crooks
A collection of eclectic react hooks
Stars: ✭ 188 (+1153.33%)
Mutual labels:  hooks, collection
use-app-state
🌏 useAppState() hook. that global version of setState() built on Context.
Stars: ✭ 65 (+333.33%)
Mutual labels:  hooks, react-hooks
Fre
πŸ‘» Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+21200%)
Mutual labels:  hooks, react-hooks
react-breakpoints
Respond to changes in a DOM element's size. With React Breakpoints, element queries are no longer "web design's unicorn" πŸ¦„
Stars: ✭ 74 (+393.33%)
Mutual labels:  hooks, react-hooks
Graphql Hooks
🎣 Minimal hooks-first GraphQL client
Stars: ✭ 1,610 (+10633.33%)
Mutual labels:  hooks, react-hooks
react-native-react-bridge
An easy way to integrate your React (or Preact) app into React Native app with WebView.
Stars: ✭ 84 (+460%)
Mutual labels:  react-dom, react-hooks
resynced
An experimental hook that lets you have multiple components using multiple synced states using no context provider
Stars: ✭ 19 (+26.67%)
Mutual labels:  hooks, react-hooks
React Form
βš›οΈ Hooks for managing form state and validation in React
Stars: ✭ 2,270 (+15033.33%)
Mutual labels:  hooks, react-hooks
jedisdb
redis like key-value state management solution for React
Stars: ✭ 13 (-13.33%)
Mutual labels:  hooks, react-hooks
15 Puzzle
The 15-puzzle is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing, built in react
Stars: ✭ 161 (+973.33%)
Mutual labels:  hooks, react-dom
react-register-nodes
Register DOM Nodes in React
Stars: ✭ 32 (+113.33%)
Mutual labels:  react-dom, react-hooks
Haunted
React's Hooks API implemented for web components πŸ‘»
Stars: ✭ 2,197 (+14546.67%)
Mutual labels:  hooks, react-hooks
useSharedState
useSharedState is a simple hook that can be used to share state between multiple React components.
Stars: ✭ 0 (-100%)
Mutual labels:  hooks, react-dom
Formik
Build forms in React, without the tears 😭
Stars: ✭ 29,047 (+193546.67%)
Mutual labels:  hooks, react-hooks
Awesome React Hooks
Awesome React Hooks
Stars: ✭ 7,616 (+50673.33%)
Mutual labels:  hooks, react-hooks
react-cool-form
😎 πŸ“‹ React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+1540%)
Mutual labels:  hooks, react-hooks
use-query-string
πŸ†™ A React hook that serializes state into the URL query string
Stars: ✭ 50 (+233.33%)
Mutual labels:  hooks, react-hooks

Tackle Box 🎣

Collection of React user-experience hooks + containers for common interactions

PRs Welcome

Getting Started

yarn add @dawnlabs/tacklebox

Usage

useAsyncCallback

🎣 hook

Takes any function and gives you a loading and error state. Good for handling general asynchronous interactions.

import { useAsyncCallback } from '@dawnlabs/tacklebox'

function MyAsyncButton(props) {
  const [onClick, { loading, error, data }] = useAsyncCallback(props.onClick)

  return (
    <>
      {error && <span>{error}!</span>}
      <button onClick={onClick}>{loading ? 'Saving...' : 'Save'}</button>
      {data && <span>Success! {data}</span>}
    </>
  )
}

useKeyboardListener

🎣 hook

Pass it a keyboard key and a handler to automatically listen for keyboard clicks.

Example
import { useKeyboardListener } from '@dawnlabs/tacklebox'

function Modal(props) {
  useKeyboardListener('Escape', props.onClose)

  return <div>Hello World</div>
}

useTempValue

hook 🎣

Hook that gives you a temporary state value that you can either commit with submit or revert with reset.

Example
import { useTempValue } from '@dawnlabs/tacklebox'

function MyForm(props) {
  const initialName = props.name
  const { hasChanged, value, onInputChange, submit, reset } = useTempValue(initialName)

  return (
    <form onSubmit={e => e.preventDefault()}>
      <input value={value || ''} onChange={onInputChange} />
      <button disabled={!hasChanged} onClick={submit}>
        Submit
      </button>
      <button disabled={!hasChanged} onClick={reset}>
        Cancel
      </button>
    </form>
  )
}

useCopyTextHandler

hook 🎣

Creates an onClick handler that copies the text you pass in, and updates the copied field accordingly. Note: you must pass onClick to a <button> in order to copy the text.

Example
import { useCopyTextHandler } from '@dawnlabs/tacklebox'

const interval = 2 * 1000 // 2 seconds

function MyCopyButton() {
  const { onClick, copied } = useCopyTextHandler('https://github.com/dawnlabs/tacklebox', {
    interval
  })

  return <button onClick={onClick}>{copied ? 'COPIED!' : 'Copy URL'}</button>
}

useOnline

hook 🎣

Subscribes to whether the network is online or off

Example
import { useOnline } from '@dawnlabs/tacklebox'

function MyComponent() {
  const online = useOnline()
  return <span>You are {online ? 'online' : 'offline'}</span>
}

Modal

wrapper HOC component

Class controlled Modal component with click-away and ESC-key to close

Example
import {Modal} from '@dawnlabs/tacklebox'

<Modal open={this.state.open} onClickAway={() => this.setState({ open: false})}>
  <form>
    <input placeholder="Enter name here . . ." />
  </form>
</>

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].