All Projects β†’ tannerlinsley β†’ Use React Hooks

tannerlinsley / Use React Hooks

Use hooks in classes in React 16.5+

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Use React Hooks

Aspects
Delightful, simple library for aspect oriented programming in Objective-C and Swift.
Stars: ✭ 8,255 (+10483.33%)
Mutual labels:  hooks
React Redux Hooks Starter
React-redux boilerplate using hooks 🎣
Stars: ✭ 69 (-11.54%)
Mutual labels:  hooks
React Antd Multi Tabs Admin
ts+react+antd-倚鑡签后台樑板(ηΊ―ε‡€η‰ˆοΌŒιž antd pro!)
Stars: ✭ 73 (-6.41%)
Mutual labels:  hooks
Use Firebase Auth
A custom React Hook that provides a declarative interface for Firebase Auth.
Stars: ✭ 61 (-21.79%)
Mutual labels:  hooks
Jsonapi React
A minimal JSON:API client and React hooks for fetching, updating, and caching remote data.
Stars: ✭ 65 (-16.67%)
Mutual labels:  hooks
React Native Appstate Hook
React Native appSate hook
Stars: ✭ 73 (-6.41%)
Mutual labels:  hooks
Fontmod
Simple hook tool to change Win32 program font.
Stars: ✭ 1,064 (+1264.1%)
Mutual labels:  hooks
Urmem
[x86] Simple C++11 header-only cross-platform memhack library (hooks, patches, pointers, sig scan)
Stars: ✭ 76 (-2.56%)
Mutual labels:  hooks
React Hookedup
πŸ‘½ A collection of useful React hooks
Stars: ✭ 68 (-12.82%)
Mutual labels:  hooks
Skeleton
A ready-to-use CodeIgniter skeleton with tons of new features and a whole new concept of hooks (actions and filters) as well as a ready-to-use and application-free themes and plugins system. Facebook Page: http://bit.ly/2oHzpxC | Facebook Group: http://bit.ly/2o3KOrA. Help me carry on making more free stuff β†’ http://bit.ly/2ppNujE ←
Stars: ✭ 74 (-5.13%)
Mutual labels:  hooks
E Commerce App React Native
E-commerce App UI. React native, Expo managed flow, React navigation v5, Notification.
Stars: ✭ 61 (-21.79%)
Mutual labels:  hooks
Use Redux
Stars: ✭ 64 (-17.95%)
Mutual labels:  hooks
Fcnpc
FCNPC - Fully Controllable NPC
Stars: ✭ 73 (-6.41%)
Mutual labels:  hooks
One Time Callbacks
Enable WordPress actions and filter callbacks to be called exactly once.
Stars: ✭ 59 (-24.36%)
Mutual labels:  hooks
Hook.io
Open-Source Microservice Hosting Platform
Stars: ✭ 1,201 (+1439.74%)
Mutual labels:  hooks
Pcsgolh
PCSGOLH - Pointless Counter-Strike: Global Offensive Lua Hooks. A open-source Lua API for CS:GO hacking written in modern C++
Stars: ✭ 56 (-28.21%)
Mutual labels:  hooks
Drei
🌭 useful helpers for react-three-fiber
Stars: ✭ 1,173 (+1403.85%)
Mutual labels:  hooks
Ysf
YSF Server Functions
Stars: ✭ 77 (-1.28%)
Mutual labels:  hooks
Hookrouter
The flexible, and fast router for react that is entirely based on hooks
Stars: ✭ 1,200 (+1438.46%)
Mutual labels:  hooks
Globalhooks
Allows you to create global keyboard events
Stars: ✭ 74 (-5.13%)
Mutual labels:  hooks

use-react-hooks

use-react-hooks adds support for hooks in React v16.6!

  • βœ‚οΈ Tiny (3kb and 200 LOC)
  • β›‘ Safely reverse-engineered using class lifecycles
  • πŸ›  Provides a clean and clear upgrade path to 16.7 when ready.

Demos

Install

npm install --save use-react-hooks
# or
yarn add use-react-hooks

Usage

To use hooks in a functional compoennt, wrap it in useHooks then use any hook you want!

import React from "react";
import { useHooks, useState } from "use-react-hooks";

const App = useHooks(props => {
  const [count, setCount] = useState(0);
  return (
    <div>
      Count: {count}
      <button onClick={() => setCount(old => old + 1)}>Increment</button>
    </div>
  );
});

Documentation

The following hooks are available as named exports from the use-react-hooks package and follow the official React Hooks API here: https://reactjs.org/docs/hooks-reference.html

  • useReducer
  • useState
  • useContext
  • useMemo
  • useCallback
  • useEffect
  • useRef
  • useImperativeMethods
  • useMutationEffect Note: currently identical to useEffect
  • useLayoutEffect Note: currently identical to useEffect

Additional Hooks

The following hooks are also provided for convenience:

  • usePrevious - Returns the previously rendered value you pass it

License

MIT Β© tannerlinsley

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