You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/fuselage-hooks/README.md
+45-6
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ yarn test
29
29
30
30
-[useAutoFocus](#useautofocus)
31
31
-[Parameters](#parameters)
32
+
-[useBreakpoints](#usebreakpoints)
32
33
-[useDebouncedCallback](#usedebouncedcallback)
33
34
-[Parameters](#parameters-1)
34
35
-[useDebouncedReducer](#usedebouncedreducer)
@@ -41,18 +42,23 @@ yarn test
41
42
-[Parameters](#parameters-5)
42
43
-[useLazyRef](#uselazyref)
43
44
-[Parameters](#parameters-6)
44
-
-[useMediaQuery](#usemediaquery)
45
+
-[useMediaQueries](#usemediaqueries)
45
46
-[Parameters](#parameters-7)
46
-
-[useMergedRefs](#usemergedrefs)
47
+
-[useMediaQuery](#usemediaquery)
47
48
-[Parameters](#parameters-8)
48
-
-[useMutableCallback](#usemutablecallback)
49
+
-[useMergedRefs](#usemergedrefs)
49
50
-[Parameters](#parameters-9)
50
-
-[useResizeObserver](#useresizeobserver)
51
+
-[useMutableCallback](#usemutablecallback)
51
52
-[Parameters](#parameters-10)
52
-
-[useSafely](#usesafely)
53
+
-[useResizeObserver](#useresizeobserver)
53
54
-[Parameters](#parameters-11)
54
-
-[useToggle](#usetoggle)
55
+
-[useSafely](#usesafely)
55
56
-[Parameters](#parameters-12)
57
+
-[Comparator](#comparator)
58
+
-[useStableArray](#usestablearray)
59
+
-[Parameters](#parameters-13)
60
+
-[useToggle](#usetoggle)
61
+
-[Parameters](#parameters-14)
56
62
-[useUniqueId](#useuniqueid)
57
63
58
64
### useAutoFocus
@@ -66,6 +72,12 @@ Hook to automatically request focus for an DOM element.
66
72
67
73
Returns **Ref<{focus: function (options: Options): void}>** the ref which holds the element
68
74
75
+
### useBreakpoints
76
+
77
+
Hook to catch which responsive design' breakpoints are active.
78
+
79
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** an array of the active breakpoint names.
80
+
69
81
### useDebouncedCallback
70
82
71
83
Hook to memoize a debounced version of a callback.
@@ -137,6 +149,16 @@ Hook equivalent to useRef, but with a lazy initialization for computed value.
137
149
138
150
Returns **any** the ref
139
151
152
+
### useMediaQueries
153
+
154
+
Hook to listen to a set of media queries.
155
+
156
+
#### Parameters
157
+
158
+
-`queries`**...[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** the CSS3 expressions of media queries
159
+
160
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a set of booleans expressing if the media queries match or not
161
+
140
162
### useMediaQuery
141
163
142
164
Hook to listen to a media query.
@@ -192,6 +214,23 @@ which can be safe and asynchronically called even after the component unmounted.
192
214
193
215
Returns **\[S, D]** a state value and safe dispatcher pair
194
216
217
+
### Comparator
218
+
219
+
Type: function (a: T, b: T): [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
220
+
221
+
### useStableArray
222
+
223
+
Hook to create an array with stable identity if its elements are equal.
224
+
225
+
#### Parameters
226
+
227
+
-`array`**T** the array
228
+
-`compare`**[Comparator](#comparator)** the equality function that checks if two array elements are
229
+
equal (optional, default `Object.is`)
230
+
231
+
Returns **T** the passed array if the elements are NOT equals; the previously
0 commit comments