I have this textfield:
const [configAssessmentReason, setConfigAssessmentReason] = React.useState("");
<InputTextfield
disabled={inputDisabled || inputDisabledNoAccess}
label={"Reasoning for Assessment"}
value={configAssessmentReason}
textArea={true}
onChange={(val) => setConfigAssessmentReason(val)}
/>
and this Hook:
const { initiative, isError, isLoading } = useFetchUniqueTableData(
strategic_initiative_key,
authToken,
selectedArchive,
{ name: "strategic_initiative" }
);
I set the value of the textfield after I get my data here:
React.useEffect(() => {
const fetchData = async () => {
......
const si = strategic_initiative[0];
setConfigAssessmentReason(si.reasoning_assessment); <- Here
......
setTimeout(() => {
hideLoader();
}, 1000);
}
};
fetchData();
}, [initiative, isError, isLoading, selectedArchive]);
My Problem
When I load the initial data: my textfield has the value "".
When I load data from the archive: my textfield has the value "ABCDEFGHIJK"
When I reselect my original data: my textfield should be "" again but has visual fragments of "ABCDEFGHIJK". The fragments will disappear, if I click on the textfield on click out.
Why does my textfield does not render correctly, when my value is ""?