格式化产品错误信息
不要直接引用这个模块!使用普通的 invariant 调用并搭配模板字符串。构建过程中,这些消息将被替换为错误代码。
// Do not require this module directly! Use normal `invariant` calls with
// template literal strings. The messages will be replaced with error codes
// during build.
// 格式化产品错误信息
function formatProdErrorMessage(code) {
let url = 'https://react.dev/errors/' + code;
if (arguments.length > 1) {
url += '?args[]=' + encodeURIComponent(arguments[1]);
for (let i = 2; i < arguments.length; i++) {
url += '&args[]=' + encodeURIComponent(arguments[i]);
}
}
return (
`Minified React error #${code}; visit ${url} for the full message or ` +
'use the non-minified dev environment for full errors and additional ' +
'helpful warnings.'
);
}
export default formatProdErrorMessage;