- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 react 类更改为无状态函数,但遇到一些错误。你能帮忙吗?该类正在以表格格式呈现列表。
我第一次尝试:
function LeaseList(props) {
return (
<Table hover bordered striped responsive>
<tbody>
{
props.isLoading ?
<div>Is Loading...</div> :
props.leases.map(lease =>
<Lease key=lease._links.self.href
lease=lease
attributes=props.attributes
handleDelete=props.handleDelete
handleUpdate=props.handleUpdate/>
);
}
</tbody>
</Table>
);
}
但出现错误:
JSX value should be either an expression or a quoted JSX text (345:39)
343 | <div>Is Loading...</div> :
344 | props.leases.map(lease =>
> 345 | <Lease key=lease._links.self.href
| ^
346 | lease=lease
347 | attributes=props.attributes
348 | handleDelete=props.handleDelete
然后我尝试在租约周围放置括号,如下所示:
function LeaseList(props) {
return (
<Table hover bordered striped responsive>
<tbody>
{
props.isLoading ?
<div>Is Loading...</div> :
props.leases.map(lease =>
<Lease key={lease._links.self.href}
lease={lease}
attributes={props.attributes}
handleDelete={props.handleDelete}
handleUpdate={props.handleUpdate}/>
);
}
</tbody>
</Table>
);
}
但出现错误:
Unexpected token, expected } (350:25)
348 | handleDelete={props.handleDelete}
349 | handleUpdate={props.handleUpdate}/>
> 350 | );
| ^
351 | }
352 | </tbody>
353 | </Table>
更新 1:删除;来自);
function LeaseList(props) {
return (
<Table hover bordered striped responsive>
<tbody>
{
props.isLoading ?
<div>Is Loading...</div> :
props.leases.map(lease =>
<Lease key=lease._links.self.href
lease=lease
attributes=props.attributes
handleDelete=props.handleDelete
handleUpdate=props.handleUpdate/>
)
}
</tbody>
</Table>
);
}
仍然失败并出现相同的错误:
JSX value should be either an expression or a quoted JSX text (345:39)
343 | <div>Is Loading...</div> :
344 | props.leases.map(lease =>
> 345 | <Lease key=lease._links.self.href
| ^
346 | lease=lease
347 | attributes=props.attributes
348 | handleDelete=props.handleDelete
最佳答案
尝试从第 345 行删除 ;
。没有理由让它在那里。另外,不要忘记在 props 周围使用 {}
。
function LeaseList(props) {
return (
<Table hover bordered striped responsive>
<tbody>
{
props.isLoading ?
<div>Is Loading...</div> :
props.leases.map(lease =>
<Lease key={lease._links.self.href}
lease={lease}
attributes={props.attributes}
handleDelete={props.handleDelete}
handleUpdate={props.handleUpdate}/>
)
}
</tbody>
</Table>
);
}
关于javascript - 这个类可以改成React无状态函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47645561/
我需要重命名目录中的所有文件。源文件名的一些示例是: alpha--sometext.381928 comp--moretext.7294058 生成的文件将重命名为: alpha.sometext.
我正在尝试编写一个方法,将 CDROM 驱动器从字母 D 更改为字母 Z,但对 WMI 没有任何运气。我可以使用 C# 执行此操作吗? public void setVolCDROM() {
考虑以下简单示例: namespace Calculus { type Func = { (arg: T): T; delta: (arg: T) => T; }; con
我编写了一个隐藏或显示所有应用程序形式(包括子形式)的方法。代码如下: public enum FormState { Show , Hidden, Enable, D
我创建了两个对象。 square1 和 square2 对象。我期望输出 Double line square object。但单个方形对象仅可见。如何做这个可见的双线方形对象? 在我的代码下面。 f
嗯,我有计算器。我想在其中接受值(value) $1,000,000格式 所以下面是我的代码,想知道如何使用 php 替换它们 直播:http://ffsng.deewayz.in/index.php
我看到 grunt.js 中的默认 linter 是 jshint,但我已经习惯了使用 jslint。是否可以更改 grunt.js 使用的 linter? 最佳答案 无耻的 self 推销 有一个插
我使用的是 EF Code First (.NET 4.5 + VS2012)。我的项目正在正确创建和使用 LocalDB。我的机器上也安装了 SQL Server Express (2008R2)。
我创建了包含 5 个 xib 的项目。当我尝试在 iPad 模拟器中运行该项目时。一些 Xibs 将采用 iPhone 屏幕尺寸。我想转换那些支持 iPad Xib 屏幕尺寸的 iphone xib。
我们的应用程序一直在工作。现在,在他们迁移到 bundler 1.0.7 之后,我第一次将一些新代码推送到 Heroku 上。现在我们的应用程序崩溃了,我收到了这个错误消息 - /usr/ruby1.
我是一名优秀的程序员,十分优秀!