강의

멘토링

커뮤니티

Inflearn Community Q&A

dyttjqdl1145's profile image
dyttjqdl1145

asked

Learn by Following Along Node, React Series - Building a Shopping Mall Site [Complete Renewal]

submit 관련 질문이 있습니다.

Written on

·

186

0

다른 분들의 질문을 통해 Antd를 사용하면 Button 태그에 이벤트핸들러를 넣어줘야 하는 것을 알았습니다.! 

궁금한건 Button에 onClick 으로 이벤트핸들러를 해주면 잘 되는데, onSubmit으로 하면 아무 반응이 안일어납니다 ㅠㅠ

<Form>
<FileUpload refreshFunction={updateImages} />

<br />
<br />
<label>이름</label>
<Input onChange={titleChangeHandler} value={Title} />
<br />
<br />
<label>설명</label>
<TextArea onChange={descriptionChangeHandler} value={Description} />
<br />
<br />
<label>가격</label>
<Input onChange={priceChangeHandler} value={Price} />
<br />
<br />
<select onChange={continentChangeHandler} value={Continent}>
{Continents.map((continent) => (
<option key={continent.key}>{continent.value}</option>
))}
</select>
<br />
<br />
<Button tpye="submit" onClick={submitHandler}>
확인
</Button>
</Form>
nodejs웹앱reactmongodbredux

Answer 3

4

해당 Button andt 디자인에가서 보니 일반 html프로퍼티인 type을 htmlType으로 바꿔주면 실행됩니다.

<Button htmlType="submit">Submit</Button>

2

John Ahn님의 프로필 이미지
John Ahn
Instructor

antDesign 컴포넌트가 이상한게 있는것 같습니다  원래는 Button에는 이벤트 핸들러 안줘도 type 만 submit 주고  form 부분에  onSubmit으로 처리 가능한데  앤트 디자인에서는 onClick 따로 넣어주셔야 됩니다 ~ ! 

0

dyttjqdl1145님의 프로필 이미지
dyttjqdl1145
Questioner

답변 감사합니다! 

dyttjqdl1145's profile image
dyttjqdl1145

asked

Ask a question