@procore/core-react
Version:
React library of Procore Design Guidelines
21 lines (20 loc) • 780 B
JavaScript
import React from 'react';
/* HOOK */
/**
* @deprecatedSince 9
* @deprecated Never officially documented/supported
*/
export function useDeprecation(config) {
var oldThing = config.oldThing,
newThing = config.newThing,
link = config.link;
var when = 'when' in config ? typeof config.when !== 'undefined' : true;
React.useLayoutEffect(function () {
if (when && ['test', 'development'].indexOf(process.env.NODE_ENV || '') >= 0) {
var notice = "".concat(oldThing, " is deprecated");
var recommendation = newThing ? ", please use ".concat(newThing) : '';
console.warn("".concat(notice).concat(recommendation), link !== null && link !== void 0 ? link : '');
}
}, [when, newThing, oldThing, link]);
}
//# sourceMappingURL=Deprecation.js.map