(#7) How works preventDefault()Method?

Definition

The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur.

const submitHandler = (e) =>{ 
e.preventDefault()
dispatch(savePaymentMethod(paymentMethod)) history.push(‘/placeorder’) }
<Form.Check
type='radio'
label='PayPal or Credit Card'
id='paypal'
name = 'paymentMethod'
checked
onChange={(e) => setPaymentMethod(e.target.value)} >
</Form.Check>

--

--

Martin Jun Cho

As a software engineer, I am embarking on a long and exciting programming journey driven by my genuine curiosity and passion.