shuashuai commented on code in PR #935:
URL: https://github.com/apache/incubator-answer/pull/935#discussion_r1596206351


##########
ui/src/pages/Questions/Ask/index.tsx:
##########
@@ -452,18 +448,18 @@ const Ask = () => {
                 {formData.content.errorMsg}
               </Form.Control.Feedback>
             </Form.Group>
+
             <Form.Group controlId="tags" className="my-3">
               <Form.Label>{t('form.fields.tags.label')}</Form.Label>
-              <Form.Control
-                defaultValue={JSON.stringify(formData.tags.value)}
-                isInvalid={formData.tags.isInvalid}
-                hidden
-              />

Review Comment:
   This is indeed the case for a standard form structure as you mentioned.
   
   I recommend the second option mainly from the perspective of ease of use of 
components, and unified management. From the first option, you can see that to 
combine this standard structure, we need to add additional attributes to the 
custom `<Form. Control />`  to conform to the standard structure. This may 
cause some confusion for some users who don’t know why.
   
   For example, you may have found code like this:
   
   
![image](https://github.com/apache/incubator-answer/assets/30591202/d89ed79a-972d-4086-ac1f-45708938a7cb)
   
   To conform to the bootstrap structure, it is easy to write such confusing 
code. At the same time, this may be done for components that use custom `form. 
control`, if the custom `form.control`  itself encapsulates the complete form 
function, it will greatly reduce the occurrence of this situation. it will also 
be easier to maintain.
   
   The following structure will make the structure simpler and will not affect 
the reading of the code.
   
   
![image](https://github.com/apache/incubator-answer/assets/30591202/644e390a-8f68-4041-8bd7-d40f80f05c29)
   
   Of course, this may be more in line with the coding habits of our team, and 
I also want to change these unusual writing methods in later versions.
   



-- 
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