有问题的类是Elastic UI中的Card-full source。如果描述文本包含div
,则会生成此错误消息:
Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
与动态选择其类型的OuterElement不同,<p>{description}</p>
始终是p
标记。如何在不覆盖整个类的情况下,仅用<p>...</p>
替换模板的<div>...</div>
部分?
return (
<OuterElement
onClick={onClick}
className={classes}
href={href}
target={target}
rel={secureRel}
{...rest}
>
{optionalBetaBadge}
{optionalCardTop}
<span className="euiCard__content">
<EuiTitle className="euiCard__title">
<span>{title}</span>
</EuiTitle>
<EuiText size="s" className="euiCard__description">
<p>{description}</p>
</EuiText>
</span>
{layout === 'vertical' &&
<span className="euiCard__footer">
{footer}
</span>
}
</OuterElement>
);
答案 0 :(得分:1)
否,不覆盖整个类是不可能的