React Hooks
HookAPI 2useState
| Signature | useState<S>(initial: S | (() => S)): [S, SetState<S>]useState<S = undefined>(): [S | undefined, SetState<S | undefined>] |
|---|
| Take it from | const { useState } = Bundleware; |
|---|
useReducer
| Signature | useReducer<S, A>(reducer: (state: S, action: A) => S, initial: S): [S, (action: A) => void]useReducer<S, A, I>(reducer: (state: S, action: A) => S, argument: I, init: (argument: I) => S): [S, (action: A) => void] |
|---|
| Take it from | const { useReducer } = Bundleware; |
|---|
useEffect
Runs after the browser paints. Throwing is reported on the toolbar.
| Signature | useEffect(effect: () => void | (() => void), deps?: readonly unknown[]): void |
|---|
| Take it from | const { useEffect } = Bundleware; |
|---|
useLayoutEffect
Runs before the browser paints; its cleanup runs synchronously on unmount.
| Signature | useLayoutEffect(effect: () => void | (() => void), deps?: readonly unknown[]): void |
|---|
| Take it from | const { useLayoutEffect } = Bundleware; |
|---|
useRef
useRef(null) for an element: <input ref={field} />, then field.current.
| Signature | useRef<T = any>(initial: null): { current: T | null }useRef<T>(initial: T): { current: T }useRef<T = undefined>(): { current: T | undefined } |
|---|
| Take it from | const { useRef } = Bundleware; |
|---|
useMemo
| Signature | useMemo<T>(factory: () => T, deps: readonly unknown[]): T |
|---|
| Take it from | const { useMemo } = Bundleware; |
|---|
useCallback
| Signature | useCallback<T extends (...args: any[]) => any>(callback: T, deps: readonly unknown[]): T |
|---|
| Take it from | const { useCallback } = Bundleware; |
|---|