with useEffect (#609)
This commit is contained in:
@@ -26,6 +26,12 @@ function ValidatedInput<T extends Record<string, unknown>> ({ className, compone
|
||||
const [validationResult, setValidationResult] = useState<Result<string>>(Result.ok(''));
|
||||
const isMounted = useIsMounted();
|
||||
|
||||
useEffect(() => {
|
||||
if (defaultValue) {
|
||||
setValue(defaultValue);
|
||||
}
|
||||
}, [defaultValue]);
|
||||
|
||||
useEffect(() => {
|
||||
// Do not show any error on first mount
|
||||
if (!isMounted) {
|
||||
|
||||
Reference in New Issue
Block a user