You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
612 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useResource = exports.default = void 0;
var _reactRedux = require("react-redux");
/**
* @load ./use-resource.doc.md
* @subcategory Hooks
* @class
* @hideconstructor
* @bundle
* @param {string} resourceId Id of a resource you want to get
*/
const useResource = resourceId => {
const resources = (0, _reactRedux.useSelector)(state => state.resources);
const foundResource = resources.find(resource => resource.id === resourceId);
return foundResource;
};
exports.useResource = exports.default = useResource;