I
I
Isaac Yui2021-08-21 21:03:07
JavaScript
Isaac Yui, 2021-08-21 21:03:07

How to cancel page refresh on post request to json-server?

I'm using form from antd
tried using e.preventDefault() doesn't help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Masson, 2021-08-22
@pumbasl

Try adding onClick={onFinish} to your form submit button
, and in the onFinish itself, catch the event and use preventdefault

<Button type="primary" htmlType="submit" onClick={onFinish}>
     Сохранить
</Button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question