e2corporation commented on code in PR #3017:
URL: https://github.com/apache/incubator-devlake/pull/3017#discussion_r966574684


##########
config-ui/src/pages/connections/webhook/index.jsx:
##########
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState } from "react";
+import { Link } from "react-router-dom";
+import { Icon, Button } from "@blueprintjs/core";
+
+import Nav from "@/components/Nav";
+import Sidebar from "@/components/Sidebar";
+import Content from "@/components/Content";
+import AppCrumbs from "@/components/Breadcrumbs";
+import { ReactComponent as WebHookProvider } from 
"@/images/integrations/webhook.svg";
+import { ReactComponent as Edit } from "@/images/icons/setting-con.svg";
+import { ReactComponent as Delete } from "@/images/icons/delete.svg";
+
+import { FormModal } from "./form-modal";
+import * as S from "./styled";
+
+export const WebHook = () => {
+  const [visible, setVisible] = useState(false);
+  // defined the form modal is add | edit | delete
+  const [modalType, setModalType] = useState("add");
+  // defined the edit or delete record
+  const [record, setRecord] = useState();
+
+  const handleShowModal = (mt, r) => {
+    setVisible(true);
+    setModalType(mt);
+    if (r) {

Review Comment:
   This can be expressed to be more declarative by removing the need for an IF 
statement, rather than making it imperative. Use the callback mechanism of the 
setter to set record value if it exists otherwise fallback to the current 
record value.
   
   ```suggestion
       setRecord(existingRecord => r ? r : existingRecord)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to