You can easily combine multiple resources together. For instance, if you want to use children resources attached to a parent store node:
import {createResource} from 'redux-rest-resource';
const hostUrl = 'http://localhost:3000';
// Parent Library Store
const libraryResource = createResource({
name: 'library',
pluralName: 'libraries',
url: `${hostUrl}/libraries/:id`
});
// Children Library Asset Store
const libraryAssetResource = createResource({
name: 'libraryAsset',
url: `${hostUrl}/libraries/:libraryId/assets/:id`
});
const types = {...libraryResource.types, ...libraryAssetResource.types};
const actions = {...libraryResource.actions, ...libraryAssetResource.actions};
import {mergeReducers} from 'redux-rest-resource';
const reducers = mergeReducers(libraryResource.reducers, {assets: libraryAssetResource.reducers});
export {types, actions, reducers};