javascript - 如何修复缺少的 jsx 表达式容器围绕文字字符串?
问题描述
我有以下代码作为工具提示。
<Tooltip
portalClassName="HelpIcon"
title="Have a question?"
content={<div>We're hard at work building out a more robust help tool. In the meantime, check out the current {helpContent} on the wiki.</div>}
centered
trigger="click"
placement="bottom"
tooltipType="popover"
>
{helpIcon}
</Tooltip>
我遇到了一个 eslint 错误
“我们正在努力构建更强大的帮助工具。与此同时,请查看 wiki 上当前的 {helpContent}。”
说“缺少围绕文字字符串的 JSX 表达式容器 (react/jsx-no-literals)”
无论如何我可以将它变成该div内的字符串以避免出现该错误?
解决方案
你也可以这样做:
<Tooltip
portalClassName="HelpIcon"
title="Have a question?"
content={<div>{'We're hard at work building out a more robust...'}</div>}
centered
trigger="click"
placement="bottom"
tooltipType="popover"
>
{helpIcon}
</Tooltip>
推荐阅读
- javascript - 将单个值传递给每个元素的解决方案
- android - 如何在flutter中从dart文件中调用android活动
- primefaces - 显示/隐藏基于 primefaces p:fileUpload 的另一个元素
- c# - 如何将模型项列表返回到 ASP.NET Core SelectListItem?
- html - 如何在表单的输入之间添加垂直空间?
- r - 从 github 安装 R 包返回非零退出状态错误;GSL 和 Rtools 已正确安装
- python - 如何将 ForeignKey 自动分配给 CBV 创建视图?
- pandas - Pandas - 按日期比较两个数据框并找到缺失的整体
- tensorflow - 触发词检测模型
- solver - 读取 gurobi lp 文件并列出约束