how to set null or undefined to avoid setting -1 in edit form
how to set null or undefined to avoid setting -1 in edit form
null or undefined using the useForm hook. However, there might be some type errors as the defaultValue type is , which is string and number only, not null or undefined. null or undefined as unknown first, then as undefined. Here's an example:null because of backend requirements, you might want to consider other solutions. For instance, if the default value of useSelect is an empty array [], you could send a null value if the array is empty.BaseKeyconst { selectProps } = useSelect({
resource: "users",
optionLabel: "name",
optionValue: "id",
defaultValue: null as unknown as undefined,
});