Drop an unneeded function
authorCarl Worth <cworth@cworth.org>
Tue, 9 Jun 2020 04:34:00 +0000 (21:34 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 9 Jun 2020 04:34:00 +0000 (21:34 -0700)
It was only one line, and only called once, so better just to inline it.

empathy/empathy.jsx

index 959c3feaea8f685f42dd60af38fc6b086d8326ab..110b330a71142a5de6c27ee0bd567a1c5abf0591 100644 (file)
@@ -212,10 +212,6 @@ class CategoryRequest extends React.PureComponent {
 
 const PromptOptions = React.memo(props => {
 
-  function handle_click(id) {
-    fetch_post_json(`vote/${id}`);
-  }
-
   if (props.prompts.length === 0)
     return null;
 
@@ -231,7 +227,7 @@ const PromptOptions = React.memo(props => {
           <button
             className="vote-button"
             key={p.id}
-            onClick={() => handle_click(p.id)}
+            onClick={() => fetch_post_json(`vote/${p.id}`) }
           >
             {p.prompt}
             <div className="vote-choices">