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
{{ message }}
This repository was archived by the owner on May 27, 2022. It is now read-only.
Triggers the provider `read` method and gives you the `data`, `loading` and `error` properties from the state of the provider or selector. When the provider cache is cleaned, it automatically triggers `read` again.
41
44
@@ -53,12 +56,37 @@ Use this hook only when you need all mentioned properties, because your componen
This hook has the same behavior and interface than the described for the [`useDataLoadingError`](#usedataloadingerrorprovider-equalityfn) one, but it returns the `data`, `loaded` and `error` properties from the state of the provider or selector.
72
+
73
+
Use this hook only when you don't want to rerender a Component each time the provider is loading. It will return `loaded` as `true` once the provider has loaded for the first time, and it will not change again. This is useful to avoid rerenders in scenarios having "pollings", for example, as it will avoid to render a "loading" each time the data is refreshed.
74
+
75
+
Take into account that the `loaded` property will not be set as `true` until a success read has finished, so the error may have a value, even when `loaded` is `false`.
76
+
77
+
#### Returns
78
+
79
+
*_(Array)_ - Array containing `data`, `loaded` and `error` properties, in that order.
Triggers `read` and gives you only the `data` property from the state of the provider or selector. When the provider cache is cleaned, it automatically triggers `read` again.
69
97
70
-
Arguments are the same than described for the [`useDataProvider` hook](#usedataproviderprovider-equalityfn).
98
+
Arguments are the same than described for the [`useDataLoadingError` hook](#usedataloadingerrorprovider-equalityfn).
This High Order Component triggers the read method of the provider and gives to the component the `data`, `loading` and `error` properties from its state. It will trigger the `read` method each time the provider cache is cleaned.
195
223
@@ -205,15 +233,15 @@ Use this HOC only when you need all mentioned properties, because your component
This hoc has the same behavior and interface than the described for the [`withDataLoadingError`](#withdataloadingerrorprovider-custompropertiesnamescomponent) one, but it provides the `data`, `loaded` and `error` properties from the state.
270
+
271
+
Use this hook only when you don't want to rerender a Component each time the provider is loading. It will return `loaded` as `true` once the provider has loaded for the first time, and it will not change again. This is useful to avoid rerenders in scenarios having "pollings", for example, as it will avoid to render a "loading" each time the data is refreshed.
272
+
273
+
Take into account that the `loaded` property will not be set as `true` until a success read has finished, so the error may have a value, even when `loaded` is `false`.
@@ -242,7 +304,7 @@ This High Order Component triggers the read method of the provider and gives to
242
304
243
305
#### Arguments
244
306
245
-
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
307
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
246
308
*`customPropName`_(String)_: By default, the HOC will pass to the component a `data` property. You can change that prop passing a new property name as second argument.
247
309
248
310
#### Examples
@@ -275,7 +337,7 @@ This High Order Component triggers the read method of the provider and gives to
275
337
276
338
#### Arguments
277
339
278
-
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
340
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
279
341
*`customPropName`_(String)_: By default, the HOC will pass to the component a `loading` property. You can change that prop passing a new property name as second argument.
280
342
281
343
#### Examples
@@ -308,7 +370,7 @@ This High Order Component triggers the read method of the provider and gives to
308
370
309
371
#### Arguments
310
372
311
-
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
373
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
312
374
*`customPropName`_(String)_: By default, the HOC will pass to the component a `loaded` property. You can change that prop passing a new property name as second argument.
313
375
314
376
#### Examples
@@ -341,7 +403,7 @@ This High Order Component triggers the read method of the provider and gives to
341
403
342
404
#### Arguments
343
405
344
-
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
406
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
345
407
*`customPropName`_(String)_: By default, the HOC will pass to the component an `error` property. You can change that prop passing a new property name as second argument.
346
408
347
409
#### Examples
@@ -374,7 +436,7 @@ This High Order Component works as the hook `usePolling` described above.
374
436
375
437
#### Arguments
376
438
377
-
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
439
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
378
440
*`interval`_(Object)_: Interval in miliseconds to clean the provider dependencies cache. Default is 5000.
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataProvider HOC docs](#withdataproviderprovider-custompropertiesnamescomponent)
458
+
*`provider`_(Object)_: [Data Provider][data-provider] provider or selector instance, or a function as described in the [withDataLoadingError HOC docs](#withdataloadingerrorprovider-custompropertiesnamescomponent)
This HOC works as the already described [`withDataProvider`](#withdataproviderprovider-custompropertiesnamescomponent), but it will render one component or another depending of the result. If the provider is loading, it will render `LoadingComponent`, if it has an error, it will render `ErrorComponent` (passing the `error` property to it), or `Component` when there is no error and it is not loading (passing the `data` property to it).
462
+
This HOC works as the already described [`withDataLoadingError`](#withdataloadingerrorprovider-custompropertiesnamescomponent), but it will render one component or another depending of the result. If the provider is loading, it will render `LoadingComponent`, if it has an error, it will render `ErrorComponent` (passing the `error` property to it), or it will render`Component` when there is no error and it is not loading (passing the `data` property to it).
This HOC works as the already described [`withDataLoadedError`](#withdataloadederrorprovider-custompropertiesnamescomponent), but it will render one component or another depending of the result. If the provider has an error, it will render `ErrorComponent` (passing the `error` property to it), if it has not loaded, it will render `NotLoadedComponent`, or it will render `Component` when there is no error and it has loaded (passing the `data` property to it).
0 commit comments