+const PromptOption = React.memo(props => {
+
+ const prompt = props.prompt;
+
+ if (prompt.votes_against.find(v => v === props.player.name))
+ return false;
+
+ return (
+ <button
+ className="vote-button"
+ key={prompt.id}
+ onClick={() => fetch_post_json(`vote/${prompt.id}`) }
+ >
+ <span
+ className="hide-button"
+ onClick={(event) => {
+ event.stopPropagation();
+ fetch_post_json(`vote_against/${prompt.id}`);
+ }}
+ >
+ ×
+ </span>
+ {prompt.prompt}
+ <div className="vote-choices">
+ {prompt.votes.map(v => {
+ return (
+ <div
+ key={v}
+ className="vote-choice"
+ >
+ {v}
+ </div>
+ );
+ })}
+ </div>
+ </button>
+ );
+});
+