I have a form and some default values, like this:
const defaultValues = {text: 'text'};
reset(defaultValues);
In the form, there are two text inputs with names text and title.
The problem is, the value of title is changing into the empty string on every change of form state:
useEffect(() => {
const form = getValues();
console.info(form, formState.touchedFields);
}, [formState]);
Gives: {text: 'text', title: ''} and an empty object for touchedFields. This is quite critical since in the application there's a big difference between an undefined value and an empty string.
How can I make RHF not to change untouched values?
edit: take a look at this example: https://codesandbox.io/s/clever-jang-d2s4n?file=/src/App.js