trait react17 extends AnyRef
- Alphabetic
- By Inheritance
- react17
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def useCallback[A](callback: A)(implicit isCallbackArg: UseCallbackArg[A]): HookResult[Reusable[A]]
Returns a memoized callback.
Returns a memoized callback.
Pass an inline callback and dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed. This is useful when passing callbacks to optimized child components that rely on reference equality to prevent unnecessary renders.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usecallback
- final def useCallbackWithDeps[D, A](deps: => D)(callback: (D) => A)(implicit arg0: Reusability[D], isCallbackArg: UseCallbackArg[A]): HookResult[Reusable[A]]
Returns a memoized callback.
Returns a memoized callback.
Pass an inline callback and dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed. This is useful when passing callbacks to optimized child components that rely on reference equality to prevent unnecessary renders.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usecallback
- final def useContext[A](ctx: Context[A]): HookResult[A]
Accepts a context object and returns the current context value for that context.
Accepts a context object and returns the current context value for that context. The current context value is determined by the value prop of the nearest
<MyContext.Provider>
above the calling component in the tree.When the nearest
<MyContext.Provider>
above the component updates, this Hook will trigger a rerender with the latest context value passed to thatMyContext
provider. Even if an ancestor usesReact.memo
orshouldComponentUpdate
, a rerender will still happen starting at the component itself usinguseContext
.A component calling
useContext
will always re-render when the context value changes. If re-rendering the component is expensive, you can optimize it by using memoization.useContext(MyContext)
only lets you read the context and subscribe to its changes. You still need a<MyContext.Provider>
above in the tree to provide the value for this context.- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usecontext
- final def useDebugValue(desc: => Any): HookResult[Unit]
Used to display a label for custom hooks in React DevTools.
Used to display a label for custom hooks in React DevTools.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usedebugvalue
- final def useEffect[A](effect: A)(implicit isEffectArg: UseEffectArg[A]): HookResult[Unit]
The callback passed to useEffect will run after the render is committed to the screen.
The callback passed to useEffect will run after the render is committed to the screen. Think of effects as an escape hatch from React’s purely functional world into the imperative world.
By default, effects run after every completed render. If you'd only like to execute the effect when your component is mounted, then use useEffectOnMount. If you'd only like to execute the effect when certain values have changed, then use useEffectWithDeps.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useeffect
- final def useEffectOnMount[A](effect: A)(implicit isEffectArg: UseEffectArg[A]): HookResult[Unit]
The callback passed to useEffect will run after the render is committed to the screen.
The callback passed to useEffect will run after the render is committed to the screen. Think of effects as an escape hatch from React’s purely functional world into the imperative world.
This will only execute the effect when your component is mounted.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useeffect
- final def useEffectWithDeps[D, A](deps: => D)(effect: (D) => A)(implicit arg0: Reusability[D], isEffectArg: UseEffectArg[A]): HookResult[Unit]
The callback passed to useEffect will run after the render is committed to the screen.
The callback passed to useEffect will run after the render is committed to the screen. Think of effects as an escape hatch from React’s purely functional world into the imperative world.
This will only execute the effect when values in the first argument change.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useeffect
- final def useLayoutEffect[A](effect: A)(implicit isEffectArg: UseEffectArg[A]): HookResult[Unit]
The signature is identical to useEffect, but it fires synchronously after all DOM mutations.
The signature is identical to useEffect, but it fires synchronously after all DOM mutations. Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside useLayoutEffect will be flushed synchronously, before the browser has a chance to paint.
Prefer the standard useEffect when possible to avoid blocking visual updates.
If you'd only like to execute the effect when your component is mounted, then use useLayoutEffectOnMount. If you'd only like to execute the effect when certain values have changed, then use useLayoutEffectWithDeps.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useLayoutEffect
- final def useLayoutEffectOnMount[A](effect: A)(implicit isEffectArg: UseEffectArg[A]): HookResult[Unit]
The signature is identical to useEffect, but it fires synchronously after all DOM mutations.
The signature is identical to useEffect, but it fires synchronously after all DOM mutations. Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside useLayoutEffect will be flushed synchronously, before the browser has a chance to paint.
Prefer the standard useEffect when possible to avoid blocking visual updates.
This will only execute the effect when your component is mounted.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useLayoutEffect
- final def useLayoutEffectWithDeps[D, A](deps: => D)(effect: (D) => A)(implicit arg0: Reusability[D], isEffectArg: UseEffectArg[A]): HookResult[Unit]
The signature is identical to useEffect, but it fires synchronously after all DOM mutations.
The signature is identical to useEffect, but it fires synchronously after all DOM mutations. Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside useLayoutEffect will be flushed synchronously, before the browser has a chance to paint.
Prefer the standard useEffect when possible to avoid blocking visual updates.
This will only execute the effect when values in the first argument change.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#useLayoutEffect
- final def useMemo[D, A](deps: => D)(create: (D) => A)(implicit arg0: Reusability[D]): HookResult[Reusable[A]]
Returns a memoized value.
Returns a memoized value.
Pass a “create” function and any dependencies. useMemo will only recompute the memoized value when one of the dependencies has changed. This optimization helps to avoid expensive calculations on every render.
Remember that the function passed to useMemo runs during rendering. Don’t do anything there that you wouldn’t normally do while rendering. For example, side effects belong in useEffect, not useMemo.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usememo
- final def useReducer[S, A](reducer: (S, A) => S, initialState: => S): HookResult[UseReducer[S, A]]
An alternative to useState.
An alternative to useState. Accepts a reducer of type
(state, action) => newState
, and returns the current state paired with a dispatch method. (If you’re familiar with Redux, you already know how this works.)useReducer is usually preferable to useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one. useReducer also lets you optimize performance for components that trigger deep updates because you can pass dispatch down instead of callbacks.
- Annotations
- @inline()
- See also
https://reactjs.org/docs/hooks-reference.html#usereducer
- final def useRef[A](initialValue: => A): HookResult[UseRef[A]]
Create a mutable ref that will persist for the full lifetime of the component.
Create a mutable ref that will persist for the full lifetime of the component.
- Annotations
- @inline()
- final def useState[A](initial: => A): HookResult[UseState[A]]
Returns a stateful value, and a function to update it.
Returns a stateful value, and a function to update it.
During the initial render, the returned state is the same as the value passed as the first argument (initialState).
During subsequent re-renders, the first value returned by useState will always be the most recent state after applying updates.
- Annotations
- @inline()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()