next
Version:
The React Framework
48 lines (46 loc) • 2.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
useLinkStatus: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
default: function() {
return LinkComponent;
},
useLinkStatus: function() {
return _link.useLinkStatus;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _jsxruntime = require("react/jsx-runtime");
const _link = /*#__PURE__*/ _interop_require_wildcard._(require("./link"));
function LinkComponent(props) {
const isLegacyBehavior = props.legacyBehavior;
const childIsHostComponent = typeof props.children === 'string' || typeof props.children === 'number' || typeof props.children?.type === 'string';
const childIsClientComponent = props.children?.type?.$$typeof === Symbol.for('react.client.reference');
if (isLegacyBehavior && !childIsHostComponent && !childIsClientComponent) {
if (props.children?.type?.$$typeof === Symbol.for('react.lazy')) {
console.error(`Using a Lazy Component as a direct child of \`<Link legacyBehavior>\` from a Server Component is not supported. If you need legacyBehavior, wrap your Lazy Component in a Client Component that renders the Link's \`<a>\` tag.`);
} else {
console.error(`Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag.`);
}
}
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_link.default, {
...props
});
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=link.react-server.js.map