@@ -10,8 +10,11 @@ import {
1010/**
1111 * Executes an asynchronous effect
1212 *
13+ * See [[useAsyncLayoutEffect]] for asynchronous layout effects
14+ *
1315 * @param effect the effect to be executed.
1416 * @param dependencies the effect's dependencies.
17+ * @category Effects
1518 */
1619export const useAsyncEffect = (
1720 effect : ( ) => Promise < void > ,
@@ -25,8 +28,11 @@ export const useAsyncEffect = (
2528/**
2629 * Executes a layout effect asynchronously.
2730 *
31+ * See [[useAsyncEffect]] for asynchronous non-layout effects
32+ *
2833 * @param effect the layout effect to be executed.
2934 * @param dependencies the effect's dependencies.
35+ * @category Effects
3036 */
3137export const useAsyncLayoutEffect = (
3238 effect : ( ) => Promise < void > ,
@@ -44,6 +50,8 @@ export const useAsyncLayoutEffect = (
4450 *
4551 * @param worker The callback function that runs a promise.
4652 * @param dependencies The callback dependencies.
53+ * @typeparam TArgs The worker's arguments' types
54+ * @typeparam TRet The worker's return type
4755 */
4856export const useWorker = < TArgs extends readonly any [ ] , TRet > (
4957 worker : ( ...args : TArgs ) => Promise < TRet > ,
@@ -81,6 +89,9 @@ export const useWorker = <TArgs extends readonly any[], TRet>(
8189 *
8290 * @param effect The effect to be executed. Receives the dependencies' previous state as arguments.
8391 * @param dependencies The effect's dependencies.
92+ * @typeparam Dependencies The dependencies' tuple type, which is type of the argument received when
93+ * the effect is executed.
94+ * @category Effects
8495 */
8596export const useEffectUpdate = < Dependencies extends readonly any [ ] > (
8697 effect : ( oldState : Dependencies ) => void | ( ( ) => void ) ,
@@ -103,6 +114,9 @@ export const useEffectUpdate = <Dependencies extends readonly any[]>(
103114 * returns a boolean defining if the effect should be executed.
104115 * @param effect The effect callback to be executed.
105116 * @param dependencies The effect's dependencies.
117+ * @typeparam Dependencies The dependencies' tuple type, which is type of the argument received when
118+ * the effect is evaluating if it should be executed.
119+ * @category Effects
106120 */
107121export const useConditionalEffect = < Dependencies extends readonly any [ ] > (
108122 evalCondition : ( oldState : Dependencies ) => boolean ,
@@ -119,6 +133,7 @@ export const useConditionalEffect = <Dependencies extends readonly any[]>(
119133 * Runs an effect when the component gets mounted.
120134 *
121135 * @param effect the effect to be executed. May be asynchronous
136+ * @category Component Lifecycle
122137 */
123138export const useDidMount = (
124139 effect : ( ) => ( ( ) => void ) | void | Promise < void > ,
@@ -140,6 +155,7 @@ export const useDidMount = (
140155 *
141156 * @param effect the effect to be executed. May be asynchronous
142157 * @param dependencies The effect's dependencies.
158+ * @category Component Lifecycle
143159 */
144160export const useDidUnmount = (
145161 effect : ( ) => void | Promise < void > ,
@@ -167,6 +183,7 @@ export const useDidUnmount = (
167183 * Creates a mutable reference object from a factory function.
168184 *
169185 * @param factory A function that returns the object to be referenced
186+ * @typeparam T The reference's type
170187 */
171188export const useLazyRef = < T extends any > (
172189 factory : ( ) => T ,
0 commit comments