我正在尝试使用Firebase中两个集合的箭头功能进行映射,因此:
如何在一个箭头功能中映射两个不同的集合?
试图做到这一点,但我找不到一种方法来介绍users.map
<tbody>
{clients.map((client, user) => (
<tr>
<td>{user.userName}</td>
<td>{client.email}</td>
<td>{client.balance}</td>
</tr>
))}
</tbody>
完整示例
class Clients extends Component {
state = {};
render() {
const { clients, users } = this.props;
if ((clients, users)) {
return (
<div>
<div className="row">
<div className="col-md-6 text-center text-info">
<h2>
<i className="fas fa-comments" /> Micro Bloggin
</h2>
</div>
</div>
<table className="table table-striped">
<thead className="thead-inverse">
<tr>
<th>User</th>
<th>Topic</th>
<th>Date</th>
</tr>
</thead>
<tbody />
<tbody>
{clients.map(client => (
<tr>
<td>{client.firstName}</td>
<td>{client.email}</td>
<td>{client.balance}</td>
<td>
<Link
to={`/client/${client.id}`}
className="btn btn-info btn-sm"
>
<i className="fas fa-arrow-circle-right" /> Read More
</Link>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
} else {
return <Spinner />;
}
}