subspace/examples/embark-dapp/app/RankItem.js

20 lines
542 B
JavaScript
Raw Normal View History

2019-09-05 19:26:37 +00:00
import React from "react";
import { observe } from "@embarklabs/subspace/react";
2019-09-05 19:26:37 +00:00
const RankItem = ({ items, onUpvote, onDownvote }) => {
if (!items) return null;
return items.map((item, i) => (
<div key={i} className="item">
<b>{i + 1}</b> - {item.addr}
<br />
Upvotes: {item.upvotes} - Downvotes: {item.downvotes}
<br />
<button onClick={onUpvote(item.addr)}>Upvote</button> |{" "}
<button onClick={onDownvote(item.addr)}>Downvote</button>
</div>
));
};
export default observe(RankItem);