All Projects β†’ beizhedenglong β†’ reason-hooks-lib

beizhedenglong / reason-hooks-lib

Licence: other
A set of reusable ReasonReact hooks.

Programming Languages

reason
219 projects
HTML
75241 projects

Projects that are alternatives of or similar to reason-hooks-lib

react-cool-form
😎 πŸ“‹ React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+693.55%)
Mutual labels:  hooks, react-hooks
max-todos
A basic Todo app developed in React.
Stars: ✭ 19 (-38.71%)
Mutual labels:  hooks, react-hooks
Reason-react-hooks
🧢 Some hooks in ReasonML for reason-react that can be useful
Stars: ✭ 14 (-54.84%)
Mutual labels:  reason-react, react-hooks
react-use-comlink
Three ways to use Comlink web workers through React Hooks (and in a typesafe manner).
Stars: ✭ 39 (+25.81%)
Mutual labels:  hooks, react-hooks
tacklebox
🎣React UX components for handling common interactions
Stars: ✭ 15 (-51.61%)
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 (+138.71%)
Mutual labels:  hooks, react-hooks
use-app-state
🌏 useAppState() hook. that global version of setState() built on Context.
Stars: ✭ 65 (+109.68%)
Mutual labels:  hooks, react-hooks
Fre
πŸ‘» Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+10206.45%)
Mutual labels:  hooks, react-hooks
use-detect-print
A react hook to detect when a page is being printed
Stars: ✭ 55 (+77.42%)
Mutual labels:  hooks, react-hooks
jedisdb
redis like key-value state management solution for React
Stars: ✭ 13 (-58.06%)
Mutual labels:  hooks, react-hooks
react-ui-hooks
🧩Simple repository of React hooks for building UI components
Stars: ✭ 20 (-35.48%)
Mutual labels:  hooks, react-hooks
use-window-focus
React Hook to check if window is focused
Stars: ✭ 19 (-38.71%)
Mutual labels:  hooks, react-hooks
reason-hooks-testing-library
ReasonML bindings for react-hooks-testing-library
Stars: ✭ 24 (-22.58%)
Mutual labels:  reason-react, react-hooks
flhooks
React like Hooks implementation for Flutter.
Stars: ✭ 38 (+22.58%)
Mutual labels:  hooks, react-hooks
re-use
βš›οΈ 🎣 A collection of hooks for ReasonReact
Stars: ✭ 27 (-12.9%)
Mutual labels:  reason-react, react-hooks
resynced
An experimental hook that lets you have multiple components using multiple synced states using no context provider
Stars: ✭ 19 (-38.71%)
Mutual labels:  hooks, react-hooks
Haunted
React's Hooks API implemented for web components πŸ‘»
Stars: ✭ 2,197 (+6987.1%)
Mutual labels:  hooks, react-hooks
React Form
βš›οΈ Hooks for managing form state and validation in React
Stars: ✭ 2,270 (+7222.58%)
Mutual labels:  hooks, react-hooks
use-query-string
πŸ†™ A React hook that serializes state into the URL query string
Stars: ✭ 50 (+61.29%)
Mutual labels:  hooks, react-hooks
useAudioPlayer
Custom React hook & context for controlling browser audio
Stars: ✭ 176 (+467.74%)
Mutual labels:  hooks, react-hooks

reason-hooks-lib

ReasonML implementation of react-hooks-lib.

open ReasonHooksLib;

[@react.component]
let make = () => {
  open State;
  let {past, present, future, set, undo, redo} = useUndo(0);

  <div>
    {"counter: " |> React.string}
    {present |> string_of_int |> React.string}
    <button onClick={_ => set(prev => prev + 1)}>
      {React.string("+1")}
    </button>
    <button disabled={List.length(past) === 0} onClick={_ => undo()}>
      {React.string("undo")}
    </button>
    <button disabled={List.length(future) === 0} onClick={_ => redo()}>
      {React.string("redo")}
    </button>
  </div>;
};

Installation

  1. yarn add reason-hooks-lib
  2. add reason-hooks-lib to bs-dependencies in your bsconfig.json

Available Hooks

  • State
    • useUndo
    • useCounter
    • useToggle
    • useStateCallback
    • createStore
  • Lifecycle
    • useDidMount
    • useWillUnmount
    • useDidUpdate
  • Feedback
    • useHover

Testing

If want to test your ReasonReact hooks easily, please take a look at reason-hooks-testing-library.

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].