zmp-react
Version:
Build full featured iOS & Android apps using ZMP & React
17 lines (15 loc) • 452 B
JavaScript
import { useEffect } from 'react';
export var useRouteProps = function useRouteProps(elRef, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
routeProps = _ref.routeProps;
useEffect(function () {
if (elRef.current) {
elRef.current.zmpRouteProps = routeProps;
}
return function () {
if (elRef.current && elRef.current.zmpRouteProps) {
delete elRef.current.zmpRouteProps;
}
};
}, [routeProps]);
};