'Input type number is blank, but stored 0 as default

The initial value is blank, but when I POST the form it is as default value 0 and not null

  const formik = useFormik({
    initialValues: {
      previous_experience: "",
     }})


     

This is the input field:

<TextField
                  fullWidth
                  label="Previous Experience Required"
                  name="previous_experience"
                  variant="outlined"
                  type="number"
                  value={formik.values.previous_experience}
                  onChange={formik.handleChange}
                  error={
                    formik.touched.previous_experience &&
                    Boolean(formik.errors.previous_experience)
                  }
                  helperText={
                    formik.touched.previous_experience &&
                    formik.errors.previous_experience
                  }
                />

How to store as a default value NULL and not ZERO?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source