onChange is not working in reactstrap custom input switch

Code:

import { CustomInput } from 'reactstrap'
...
const changeMediaStatus = (e) => { console.log(e)
}
...
<CustomInput type="switch" className="ml-auto mr-1" onChange={(e) =>changeMediaStatus(e)}
/>

On the above code, the function that is assigned at "onChange" prop is not working. And also, CustomInput component with onChange prop is not working.

How can I assign a function to onChange event at reactstrap CustomInput compoenent?

3

1 Answer

Provide id for the CustomInput.

<CustomInput type="switch" className="ml-auto mr-1" onChange={(e) => changeMediaStatus(e)} />

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like