resourcerer 1.0.0-beta-2 → 1.0.0-beta-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -29
- package/lib/collection.js +7 -0
- package/lib/model.js +7 -0
- package/lib/prefetch.js +2 -2
- package/package.json +1 -1
- package/test/prefetch.test.js +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ Additional features include:
|
|
|
17
17
|
* refetching
|
|
18
18
|
* updating a component when a resource updates
|
|
19
19
|
* zero dependencies
|
|
20
|
+
* < 10kB!
|
|
20
21
|
* ...and more
|
|
21
22
|
|
|
22
23
|
Getting started is easy:
|
|
@@ -133,11 +134,11 @@ There's a lot there, so let's unpack that a bit. There's also a lot more that we
|
|
|
133
134
|
1. [Other Common Resource Config Options](#other-common-resource-config-options)
|
|
134
135
|
1. [data](#data)
|
|
135
136
|
1. [options](#options)
|
|
136
|
-
1. [attributes](#attributes)
|
|
137
137
|
1. [noncritical](#noncritical)
|
|
138
138
|
1. [forceFetch](#forcefetch)
|
|
139
139
|
1. [Custom Resource Names](#custom-resource-names)
|
|
140
140
|
1. [prefetches](#prefetches)
|
|
141
|
+
1. [attributes](#attributes)
|
|
141
142
|
1. [Data mutations](#data-mutations)
|
|
142
143
|
1. [Differences between useResources and withResources](#differences-between-useresources-and-withresources)
|
|
143
144
|
1. [Caching Resources with ModelCache](#caching-resources-with-modelcache)
|
|
@@ -153,7 +154,7 @@ There's a lot there, so let's unpack that a bit. There's also a lot more that we
|
|
|
153
154
|
|
|
154
155
|
`$ npm i resourcerer`
|
|
155
156
|
|
|
156
|
-
`resourcerer` requires on React >= 16 but has no external dependencies.
|
|
157
|
+
`resourcerer` requires on React >= 16.8 but has no external dependencies.
|
|
157
158
|
|
|
158
159
|
Note that Resourcerer uses ES2015 in its source and does no transpiling—including import/export (Local babel configuration is for testing, only).
|
|
159
160
|
This means that if you're not babelifying your `node_modules` folder, you'll need to make an exception for this package, ie:
|
|
@@ -173,7 +174,7 @@ module: {
|
|
|
173
174
|
|
|
174
175
|
1. **Props**. Going forward in this tutorial, we'll try to describe behavior of both the `useResources` hook and the `withResources` HOC at once; we'll also rotate between the two in examples. Note that if we talking about a passed prop of, for example `isLoading`, that that corresponds to an `isLoading` property returned from the hook and a `this.props.isLoading` prop passed down from the HOC.
|
|
175
176
|
|
|
176
|
-
1. **ResourceKeys**. These are the keys added to the `ModelMap` in the introduction that link to your model constructors. They are passed to the executor functions and are used to tell the hook or HOC which resources to request.
|
|
177
|
+
1. **ResourceKeys**. These are the keys added to the `ModelMap` (discussed above in the introduction) that link to your model constructors. They are passed to the executor functions and are used to tell the hook or HOC which resources to request.
|
|
177
178
|
|
|
178
179
|
1. **Executor Function**. The executor function is a function that both the hook and HOC accept that declaratively describes which resources to request and with what config options. It accepts `ResourceKeys` and `props` as arguments and may look like, as we'll explore in an example later:
|
|
179
180
|
|
|
@@ -209,8 +210,9 @@ module: {
|
|
|
209
210
|
Okay, back to the initial example. Let's take a look at our `useResources` usage in the component:
|
|
210
211
|
|
|
211
212
|
```js
|
|
212
|
-
// Note: in these docs, you will see a combination of `ResourceKeys` in the executor
|
|
213
|
-
// its more common destructured version, ie
|
|
213
|
+
// Note: in these docs, you will see a combination of `ResourceKeys` in the executor
|
|
214
|
+
// function as well as its more common destructured version, ie:
|
|
215
|
+
// `@withResources(({TODOS}, props) => ({[TODOS]: {}}))`
|
|
214
216
|
const getResources = (ResourceKeys, props) => ({[ResourceKeys.TODOS]: {}});
|
|
215
217
|
|
|
216
218
|
export default function MyComponent(props) {
|
|
@@ -238,15 +240,15 @@ ModelMap.add({TODOS: TodosCollection});
|
|
|
238
240
|
|
|
239
241
|
(We can also pass custom prefixes for our prop names in a component, but [we'll get to that later](#custom-resource-names).)
|
|
240
242
|
|
|
241
|
-
Back to the executor function. In the example above, you see it returns an object of `{[ResourceKeys.TODOS]: {}}`. In general, the object it should return is of type `{string<ResourceKey>: object<Options>}`, where `Options` is a generic map of config options
|
|
243
|
+
Back to the executor function. In the example above, you see it returns an object of `{[ResourceKeys.TODOS]: {}}`. In general, the object it should return is of type `{string<ResourceKey>: object<Options>}`, where `Options` is a generic map of config options. It can contain as many keys as resources you would like the component to request. In our initial example, the options object was empty. Further down, we'll go over the plethora of options and how to use them. For now let's take a look at some of the resource-related props this simple configuration provides our component.
|
|
242
244
|
|
|
243
245
|
|
|
244
246
|
## Other Props Returned from the Hook/Passed from the HOC (Loading States)
|
|
245
247
|
|
|
246
|
-
Of course, in our initial example, the
|
|
248
|
+
Of course, in our initial example, the `todosCollection` won’t be populated with data immediately since, after all, the resource has to be fetched from the API. Some of the most **significant** and most common React UI states we utilize are whether a component’s critical resources have loaded entirely, whether any are still loading, or whether any have errored out. This is how we can appropriately cover our bases—i.e., we can ensure the component shows a loader while the resource is still in route, or if something goes wrong, we can ensure the component will still fail gracefully and not break the layout. To address these concerns, the `useResources` hook/`withResources` HOC gives you several loading state helper props. From our last example:
|
|
247
249
|
|
|
248
250
|
|
|
249
|
-
- `todosLoadingState` (can be equal to any of the [LoadingStates constants](https://github.com/noahgrant/resourcerer/blob/master/lib/constants.js)
|
|
251
|
+
- `todosLoadingState` (can be equal to any of the [LoadingStates constants](https://github.com/noahgrant/resourcerer/blob/master/lib/constants.js). There will be one for each resource, and the property names will be equal to `${resourceKey}LoadingState`)
|
|
250
252
|
- `hasLoaded` {boolean} - all critical resources have successfully completed and are ready to be used by the component
|
|
251
253
|
- `isLoading` {boolean} - any of the critical resources are still in the process of being fetched
|
|
252
254
|
- `hasErrored` {boolean} - any of the critical resource requests did not complete successfully
|
|
@@ -254,7 +256,7 @@ Of course, in our initial example, the todos collection won’t get passed down
|
|
|
254
256
|
`isLoading` , `hasLoaded` , and `hasErrored` are not based on individual loading states, but are rather a collective loading state for the aforementioned-critical component resources. In the previous example, the todos resource is the only critical resource, so `isLoading` / `hasLoaded` / `hasErrored` are solely based on `todosLoadingState`. But we can also add a non-critical `users` resource, responsible, say, for only display users' names alongside their TODOs—a small piece of the overall component and not worth delaying render over. Here’s how we do that:
|
|
255
257
|
|
|
256
258
|
```js
|
|
257
|
-
const getResources = ({TODOS,
|
|
259
|
+
const getResources = ({TODOS, USERS}, props) => ({
|
|
258
260
|
[TODOS]: {},
|
|
259
261
|
[USERS]: {noncritical: true}
|
|
260
262
|
});
|
|
@@ -306,7 +308,8 @@ function MyClassWithTodosAndAUsers(props) {
|
|
|
306
308
|
|
|
307
309
|
{hasLoaded ? (
|
|
308
310
|
// at this point we are guaranteed all critical resources have returned.
|
|
309
|
-
// before that, todosCollection is a Collection instance
|
|
311
|
+
// before that, todosCollection is still a Collection instance that can be
|
|
312
|
+
// mapped over--it's just empty
|
|
310
313
|
<ul>
|
|
311
314
|
{todosCollection.map((todoModel) => (
|
|
312
315
|
<li key={todoModel.id}>
|
|
@@ -335,7 +338,7 @@ And here's what it looks like when the stats endpoint returns:
|
|
|
335
338
|
|
|
336
339
|

|
|
337
340
|
|
|
338
|
-
There’s one other loading prop offered from the hook/HOC: `hasInitiallyLoaded`. This can be useful for showing a different UI for components that have already fetched the resource. An example might be a component with filters:
|
|
341
|
+
There’s one other loading prop offered from the hook/HOC: `hasInitiallyLoaded`. This can be useful for showing a different UI for components that have already fetched the resource. An example might be a component with filters: when a filter is changed after the initial resource is loaded (thus re-fetching the resource), we may want to show a loader with an overlay over the previous version of the component. See the [Advanced Topics docs](/docs/advanced_topics.md#loading-overlays) for more.
|
|
339
342
|
|
|
340
343
|
|
|
341
344
|
## Requesting Prop-driven Data
|
|
@@ -373,13 +376,13 @@ export default class UserModel extends Model {
|
|
|
373
376
|
}
|
|
374
377
|
```
|
|
375
378
|
|
|
376
|
-
The `cacheFields` static property is important here, as we'll see in a second; it is a list of
|
|
379
|
+
The `cacheFields` static property is important here, as we'll see in a second; it is a list of properties that `resourcerer` will use to generate a cache key for the model. It will look for the `userId` property in the following places, in order:
|
|
377
380
|
|
|
378
|
-
1. the `options` object
|
|
379
|
-
1. the `attributes` object
|
|
380
|
-
1. the `data`
|
|
381
|
+
1. the `options` object a model/collection is initialized with
|
|
382
|
+
1. the `attributes` object a model is initialized with
|
|
383
|
+
1. the `data` a model/collection gets passed in a fetch
|
|
381
384
|
|
|
382
|
-
All three of these come from
|
|
385
|
+
All three of these come from via the [Resource Configuration Object](#nomenclature) that is returned from our executor function; it might look like this:
|
|
383
386
|
|
|
384
387
|
```jsx
|
|
385
388
|
const getResources = ({USER}, props) => ({[USER]: {options: {userId: props.id}}})
|
|
@@ -414,7 +417,7 @@ In general, there are two ways to change `props.id` as in the previous example:
|
|
|
414
417
|
|
|
415
418
|
## Serial Requests
|
|
416
419
|
|
|
417
|
-
In most situations, all resource requests should be parallelized; but that’s not always possible. Every so often, there may be a situation where one request depends on the result of another. For these cases, we have the `dependsOn` resource option and the `provides` resource option. These are probably best explained by example, so here is a simplified instance from the [Sift](https://sift.com) Console, where we load a queue item that has info about a user, but we can't get further user information until we know what user id belongs to this queue item.
|
|
420
|
+
In most situations, all resource requests should be parallelized; but that’s not always possible. Every so often, there may be a situation where one request depends on the result of another. For these cases, we have the `dependsOn` resource config option and the `provides` resource config option. These are probably best explained by example, so here is a simplified instance from the [Sift](https://sift.com) Console, where we load a queue item that has info about a user, but we can't get further user information until we know what user id belongs to this queue item.
|
|
418
421
|
|
|
419
422
|
```js
|
|
420
423
|
@withResources(({QUEUE_ITEM, USER}, props) => ({
|
|
@@ -436,7 +439,7 @@ function getUserIdFromItem(queueItemModel) {
|
|
|
436
439
|
|
|
437
440
|
In this simplified example, only `props.itemId` is initially present at the url `items/<itemId>`, and since the UserModel depends on `props.userId` being present, that model won’t initially get fetched. Only the QueueItemModel gets fetched at first; it has the `provides` option, which is a map of `<string: function>`, where the string is the prop that it provides to the HOC wrapper, and the function is a private static ‘transform’ function—it takes its model as an argument and returns the value for the prop it provides.
|
|
438
441
|
|
|
439
|
-
So, in this case, `getUserIdFromItem` is the transform function, which takes the `queueItemModel` as an argument and returns the userId that will be assigned to `props.userId` (or, more accurately, will be set as state
|
|
442
|
+
So, in this case, `getUserIdFromItem` is the transform function, which takes the `queueItemModel` as an argument and returns the userId that will be assigned to `props.userId` (or, more accurately, will be set as state via `setResourceState` as described in the previous section). When the QueueItemModel resource returns, the transform function is invoked; at that point, `props.userId` exists, and the UserModel will be fetched. And we have serially requested our resources!
|
|
440
443
|
|
|
441
444
|
One thing to note here is that while the `QUEUE_ITEM` resource is being fetched, the user resource is in a `PENDING` state, which is a special state that does not contribute to overall component `isLoading`/`hasErrored` states (though it will keep the component from being `hasLoaded`). At this point, the `QueueItemPage` in the example above is in a `LOADING` state (`isLoading === true`) because `QUEUE_ITEM` is loading. When it returns with the user id, the `USER` resource is put into a `LOADING` state, and the component then remains `isLoading === true` until it returns, after which the component has successfully loaded. If the `QUEUE_ITEM` resource happened to error, for some reason, the `USER` resource would never get out of its `PENDING` state, and the component would then take on the `ERROR` state (`hasErrored === true`) of `QUEUE_ITEM`. For more on `PENDING`, see [Thoughts on the PENDING State](/docs/advanced_topics.md#thoughts-on-the-pending-resource) in the [Advanced Topics document](/docs/advanced_topics.md).
|
|
442
445
|
|
|
@@ -476,7 +479,7 @@ function getUserDataFromItem(queueItemModel) {
|
|
|
476
479
|
|
|
477
480
|
### data
|
|
478
481
|
|
|
479
|
-
The `data` option is passed directly to the [sync](/docs/model.md#sync)
|
|
482
|
+
The `data` option is passed directly to the [sync method](/docs/model.md#sync) and sent either as stringified query params (GET requests) or as a body (POST/PUT). Its properties are also referenced when generating a cache key if they are listed in a model's static `cacheFields` property (See the [cache key section](#declarative-cache-keys) for more). Let's imagine that we have a lot of users and a lot of todos per user. So many that we only want to fetch the todos over a time range selected from a dropdown, sorted by a field also selected by a dropdown. These are query parameters we'd want to pass in our `data` property:
|
|
480
483
|
|
|
481
484
|
```js
|
|
482
485
|
@withResources((ResourceKeys, props) => {
|
|
@@ -522,11 +525,7 @@ const getResources = (ResourceKeys, props) => {
|
|
|
522
525
|
};
|
|
523
526
|
```
|
|
524
527
|
|
|
525
|
-
Here, the UserTodos collection will be instantiated with an options hash including the `userId` property, which it uses to construct its url. We'll also want to add the `'userId'` string to the collection's [static `cacheFields` array](#requesting-prop-driven-data), because each cached collection should be specific to the user.
|
|
526
|
-
|
|
527
|
-
### attributes
|
|
528
|
-
|
|
529
|
-
Pass in an attributes hash to initialize a Model instance with a body before initially fetching. This is passed directly to the [model](/docs/model.md#constructor) or [collection's](/docs/collection.md#constructor) `constructor` method along with the [`options`](#options) property, and is typically less useful than providing the properties directly to the [`data`](#data) property. Like `data` and `options`, the `attributes` object will also be used in cache key generation if it has any fields specified in the model's static `cacheFields` property (See the [cache key section](#declarative-cache-keys) for more).
|
|
528
|
+
Here, the UserTodos collection will be instantiated with an options hash including the `userId` property, which it uses to construct its url. We'll also want to add the `'userId'` string to the collection's [static `cacheFields` array](#requesting-prop-driven-data), because each cached collection should be specific to the user. Whereas the [`data` object](#data) is the place to add query param data (GET) or body data (POST/PUT/PATCH), the `options` object is a great place to add _path param_ data, as in this UserModel example's url (`/users/${this.userId}`).
|
|
530
529
|
|
|
531
530
|
|
|
532
531
|
### noncritical
|
|
@@ -605,6 +604,10 @@ When the user clicks on a 'next' arrow that updates page state, the collection w
|
|
|
605
604
|
|
|
606
605
|
If you're looking to optimistically prefetch resources when a user hovers, say, over a link, see the [Prefetch on Hover](#prefetch-on-hover) section.
|
|
607
606
|
|
|
607
|
+
### attributes
|
|
608
|
+
|
|
609
|
+
Pass in an attributes hash to initialize a Model instance with a body before initially fetching. This is passed directly to the [model](/docs/model.md#constructor) `constructor` method along with the [`options`](#options) property, and is typically much less useful than providing the properties directly to the [`data`](#data) property. Like `data` and `options`, the `attributes` object will also be used in cache key generation if it has any fields specified in the model's static `cacheFields` property (See the [cache key section](#declarative-cache-keys) for more). For [Collections](/docs/collection.md#constructor), there is an equivalent `models` property, but again, these are seldom used.
|
|
610
|
+
|
|
608
611
|
# Data Mutations
|
|
609
612
|
|
|
610
613
|
So far we've only discussed fetching data. But `resourcerer` also makes it very easy to make write requests via the [Model](/docs/model.md) and [Collection](/docs/collection.md) instances that are returned. These classes are enriched data structures that hold our API server data as well as several utilities that help manage the server data in our application. There are three main write operations via these classes:
|
|
@@ -684,7 +687,7 @@ The hook and HOC largely operate interchangeably, but do note a couple critical
|
|
|
684
687
|
|
|
685
688
|
1. The `withResources` HOC conveniently contains an [ErrorBoundary](https://reactjs.org/docs/error-boundaries.html) with every instance, but such functionality [does not yet exist in hooks](https://reactjs.org/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes). This is a definite advantage for the HOC right now, since, if we're already setting `hasErrored` clauses in our components to prepare for request errors, we can naturally gracefully degrade when an unexpected exception occurs. You'll need to manage this yourself with hooks until the equivalent functionality is released.
|
|
686
689
|
|
|
687
|
-
1.
|
|
690
|
+
1. The executor function for a hook can be inlined in your component, which puts component props in its closure scope. So be extra careful to avoid this anti-pattern:
|
|
688
691
|
|
|
689
692
|
```js
|
|
690
693
|
function MyComponent({start_time, ...props}) {
|
|
@@ -702,7 +705,7 @@ The hook and HOC largely operate interchangeably, but do note a couple critical
|
|
|
702
705
|
// ...
|
|
703
706
|
```
|
|
704
707
|
|
|
705
|
-
or define your executor function outside of the component scope, as we've done throughout this tutorial (now you know why!):
|
|
708
|
+
or, even clearer, define your executor function outside of the component scope, as we've done throughout this tutorial (now you know why!):
|
|
706
709
|
|
|
707
710
|
```js
|
|
708
711
|
const getResources = ({TODOS}, {start_time}) => ({[TODOS]: {data: {start_time}}});
|
|
@@ -773,7 +776,7 @@ export class UserTodosCollection extends Collection {
|
|
|
773
776
|
|
|
774
777
|
We can see that `limit` and `sort_field` as specified in `cacheFields` are taken straight from the `data` object that `resourcerer` transforms into url query parameters. `userId` is part of the `/users/{userId}/todos` path, so it can't be part of the `data` object, which is why it's stored as an instance property. But `resourcerer` will see its value within the `options` hash that is passed and use it for the cache key.
|
|
775
778
|
|
|
776
|
-
The time range is a little tougher to cache, though. We're less interested the spcecific `end_time`/`start_time` values to the millisecond—
|
|
779
|
+
The time range is a little tougher to cache, though. We're less interested the spcecific `end_time`/`start_time` values to the millisecond—it does us little good to cache an endpoint tied to `Date.now()` when it will never be the same for the next request. We're much more interested in the difference between `end_time` and `start_time`. This is a great use-case for a function entry in `cacheFields`, which takes the `data` object passed an argument. In the case above, the returned object will contribute a key called `range` and a value equal to the time range to the cache key.
|
|
777
780
|
|
|
778
781
|
The generated cache key would be something like `userTodos_limit=50_$range=86400000_sort_field=importance_userId=noah`. Again, note that:
|
|
779
782
|
|
|
@@ -790,7 +793,7 @@ You can use `resourcerer`'s executor function to optimistically prefetch resourc
|
|
|
790
793
|
import {prefetch} from 'resourcerer';
|
|
791
794
|
|
|
792
795
|
// here's our executor function just as we pass to useResources or withResources
|
|
793
|
-
const getTodos = (
|
|
796
|
+
const getTodos = (ResourceKeys, props) => {
|
|
794
797
|
const now = Date.now();
|
|
795
798
|
|
|
796
799
|
return {
|
|
@@ -917,7 +920,7 @@ ResourcesConfig.set(configObj);
|
|
|
917
920
|
|
|
918
921
|
* `queryParamsPropName` (string): the name of the prop representing url query parameters that `withResources` will look for and flatten for its children. If your application already flattens query parameters, you can ignore this property. Otherwise, when a url search string of, for example, `?end_time=1558100000000&start_time=1555508000000` is turned into an object prop of `{end_time: 1558100000000, start_time: 1555508000000}`, `withResources`-wrapped components will see `props.end_time` and `props.start_time`, and `useResources` will return `end_time` and `start_time` for ease of use in your executor function. **Default:** `'urlParams'`.
|
|
919
922
|
|
|
920
|
-
* `track` (function): method invoked when [`measure
|
|
923
|
+
* `track` (function): method invoked when [a `measure` property is added to a Model or Collection](#tracking-request-times). Use this hook to send the measured data to your application analytics tracker. **Default:** noop. The method is invoked with two arguments:
|
|
921
924
|
|
|
922
925
|
* the event string, `'API Fetch'`
|
|
923
926
|
* event data object with the following properties:
|
package/lib/collection.js
CHANGED
|
@@ -54,6 +54,13 @@ export default class Collection {
|
|
|
54
54
|
*/
|
|
55
55
|
static cacheFields = []
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Use this to tell resourcerer to track this collection's request time via the `track` method
|
|
59
|
+
* added in the resourcerer configuration file. This can be a boolean or a function that returns a
|
|
60
|
+
* boolean. If the latter, it takes a the resource config object as an argument.
|
|
61
|
+
*/
|
|
62
|
+
static measure = false
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* Similar to the method for an individual model, this maps through each model in the collection
|
|
59
66
|
* and returns its data attributes.
|
package/lib/model.js
CHANGED
|
@@ -60,6 +60,13 @@ export default class Model {
|
|
|
60
60
|
*/
|
|
61
61
|
static defaults = {}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Use this to tell resourcerer to track this model's request time via the `track` method added
|
|
65
|
+
* in the resourcerer configuration file. This can be a boolean or a function that returns a
|
|
66
|
+
* boolean. If the latter, it takes a the resource config object as an argument.
|
|
67
|
+
*/
|
|
68
|
+
static measure = false
|
|
69
|
+
|
|
63
70
|
/**
|
|
64
71
|
* Returns a copy of the model's `attributes` object. Use this method to get the current entire
|
|
65
72
|
* server data representation.
|
package/lib/prefetch.js
CHANGED
|
@@ -13,14 +13,14 @@ const PREFETCH_TIMEOUT = 50;
|
|
|
13
13
|
*
|
|
14
14
|
* @param {function} getResources - function that takes props as an argument
|
|
15
15
|
* and should return a map of resources. Identical to those used in
|
|
16
|
-
* `withResources`
|
|
16
|
+
* `useResources`/`withResources`
|
|
17
17
|
* @param {object} expectedProps - props in the form expected when the resource
|
|
18
18
|
* would be needed
|
|
19
19
|
* @return {function} callback to be invoked onMouseEnter of appropriate DOM el
|
|
20
20
|
*/
|
|
21
21
|
export default (getResources, expectedProps={}) => {
|
|
22
22
|
var fetched,
|
|
23
|
-
resources = Object.entries(getResources(
|
|
23
|
+
resources = Object.entries(getResources(ResourceKeys, expectedProps) || {});
|
|
24
24
|
|
|
25
25
|
return (evt) => {
|
|
26
26
|
var {target} = evt,
|
package/package.json
CHANGED
package/test/prefetch.test.js
CHANGED
|
@@ -6,7 +6,7 @@ import prefetch from '../lib/prefetch';
|
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
7
|
|
|
8
8
|
const renderNode = document.createElement('div');
|
|
9
|
-
const getResources = (
|
|
9
|
+
const getResources = ({DECISIONS, USER}, props) => ({
|
|
10
10
|
[USER]: {
|
|
11
11
|
data: {home: props.home, source: props.source},
|
|
12
12
|
options: {userId: props.userId}
|