exectx-react
Check out the wiki page for exectx-react
.
Constants
- defaultContext
The default React context that is used.
Functions
-
createContext(values, parent) ⇒
ReactContext.<V>
Creates a React context for a {@linkcode Context}. It can be nested using the {@linkcode ContextProvider}.
-
useContext(context) ⇒
Context
React hook for consuming a provided {@linkcode Context}.
-
useExecution(parent, deps) ⇒
Execution
React hook for using an {@linkcode Execution} that is canceled when the component is unmounted.
-
useExecutionFunc(innerFunc, options, deps) ⇒
ExecutionFunc
React hook for using an execution-dependent function and cancel any pending call when the component is unmounted.
-
useExecutionSlot(parent, deps) ⇒
ExecutionSlot
React hook for using an {@linkcode ExecutionSlot} that is canceled when the component is unmounted or when the
deps
change.-
useResolvedValue(options, deps) ⇒
RT
|undefined
React hook for using a resolved value and cancelling any pending resolution of the value when the component unmounts or when any of the specified
deps
change.
defaultContext
The default React context that is used.
ReactContext.<V>
createContext(values, parent) ⇒ Creates a React context for a {@linkcode Context}. It can be nested using the {@linkcode ContextProvider}.
Kind: global function
Returns: ReactContext.<V>
-
The created React context.
Param | Type | Description |
---|---|---|
values | V |
Default values to set to the root context. |
parent | ContextParentArg.<V> |
arent(s) to inherit values and/or cancellation state from. |
Context
useContext(context) ⇒ React hook for consuming a provided {@linkcode Context}.
Kind: global function
Returns: Context
-
The consumed context.
See
- {@linkcode ContextProvider}
- {@linkcode createReactContext}
Param | Type | Description |
---|---|---|
context | ReactContext |
The React context to consume. Defaults to the {@linkcode defaultContext}. |
Execution
useExecution(parent, deps) ⇒ React hook for using an {@linkcode Execution} that is canceled when the component is unmounted.
Kind: global function
Returns: Execution
-
The constructed execution.
Param | Type | Description |
---|---|---|
parent | ExecutionsArg |
If defined, the returned execution will be nested from the specified parent(s). If specified as an array and the |
deps | ReadonlyArray |
When identities of the |
ExecutionFunc
useExecutionFunc(innerFunc, options, deps) ⇒ React hook for using an execution-dependent function and cancel any pending call when the component is unmounted.
Kind: global function
Returns: ExecutionFunc
-
The transformed execution func, which accepts an execution as the final optional parameter.
Param | Type | Description |
---|---|---|
innerFunc | InnerExecutionFunc |
Function that receives the passed parameters and an execution as the final parameter. |
options | ExecutionFuncOptions |
Options for the behaviour of the execution function. For instance, these allow for using the previously returned value of the function if the arguments and the passed execution are deemed equal. |
deps | ReadonlyArray |
When identities of the |
ExecutionSlot
useExecutionSlot(parent, deps) ⇒ React hook for using an {@linkcode ExecutionSlot} that is canceled when the component is unmounted or when the deps
change.
Kind: global function
Returns: ExecutionSlot
-
The constructed execution slot.
Param | Type | Description |
---|---|---|
parent | ExecutionsArg |
If defined, the returned execution slot will be nested from the specified parent(s). If specified as an array and the |
deps | ReadonlyArray |
When identities of the |
RT
| undefined
useResolvedValue(options, deps) ⇒ React hook for using a resolved value and cancelling any pending resolution of the value when the component unmounts
or when any of the specified deps
change.
Kind: global function
Returns: RT
| undefined
-
The resolved value, or undefined if it's currently being resolved.
Param | Type | Description |
---|---|---|
options | ExecutionResolveOptions |
Specifies how to resolve the value and configures the use of executions. If an |
deps | ReadonlyArray |
When identities of the |
Authors
- Ludvig Aldén @ludvigalden