@forge/react
11.18.0-next.011.18.0-next.1
out/router/hooks/useParams.js+
out/router/hooks/useParams.jsNew file+19
Index: package/out/router/hooks/useParams.js
===================================================================
--- package/out/router/hooks/useParams.js
+++ package/out/router/hooks/useParams.js
@@ -0,0 +1,19 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.useParams = void 0;
+const react_1 = require("react");
+const ParamsContext_1 = require("../components/ParamsContext");
+/**
+ * This hook returns an object containing the dynamic parameters extracted from the current URL, as defined by the matching Route component's path prop.
+ * It must be used within a Route component.
+ *
+ * @see [useParams](https://developer.atlassian.com/platform/forge/ui-kit/hooks/use-params/) in UI Kit documentation for more information
+ */
+const useParams = () => {
+ const context = (0, react_1.useContext)(ParamsContext_1.ParamsContext);
+ if (context === null) {
+ throw new Error('useParams must be used within a Route component');
+ }
+ return context;
+};
+exports.useParams = useParams;