From 68a66356ecb9d184e44b8d75e1f7db25926d4af3 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 7 Jun 2020 15:14:10 -0700 Subject: [PATCH] Convert CategoryRequest from a function to a class This seems like it will be more convenient for defining additional methods to get access to from the JSX code (such as a submit handler function). --- empathy/empathy.jsx | 62 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 9ebe9f3..cd80629 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -122,36 +122,42 @@ async function fetch_put_json(api = '', data = {}) { return fetch_method_json('PUT', api, data); } -function CategoryRequest(props) { - return ( -
-

Submit a Category

-

+class CategoryRequest extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( +

+

Submit a Category

+

Suggest a category to play with your friends. Don't forget to include the number of items for each person to submit. -

- -
-
- - -
- -
- -
- -
-
- ); +

+ +
+
+ + +
+ +
+ +
+ +
+
+ ); + } } class Game extends React.Component { -- 2.43.0