Replies: 1 comment 5 replies
-
This is what I ended up using: type HiddenInputProps = {
name: string;
value: string;
};
function HiddenInput({ name, value }: HiddenInputProps) {
const ref = useRef<HTMLInputElement>(null);
useEffect(() => {
if (ref.current) {
ref.current.dispatchEvent(new Event("input", { bubbles: true }));
}
}, [value]);
return <input ref={ref} type="hidden" name={name} value={value} />;
} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
useValue with hidden inputs is not re-rendering. Is it because hidden inputs don't emit input events?
Beta Was this translation helpful? Give feedback.
All reactions