zmp-react
Version:
Build full featured iOS & Android apps using ZMP & React
25 lines (19 loc) • 569 B
JavaScript
;
exports.__esModule = true;
exports.useRouteProps = void 0;
var _react = require("react");
var useRouteProps = function useRouteProps(elRef, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
routeProps = _ref.routeProps;
(0, _react.useEffect)(function () {
if (elRef.current) {
elRef.current.zmpRouteProps = routeProps;
}
return function () {
if (elRef.current && elRef.current.zmpRouteProps) {
delete elRef.current.zmpRouteProps;
}
};
}, [routeProps]);
};
exports.useRouteProps = useRouteProps;