For some reason react input always jumps to the end of the field.
Try to type something, then change caret to anywhere else and type further.
Is Valtio doesn't work with controlled components or am I missing something?
import React from "react";
import { proxy, useSnapshot } from "valtio";
// create a base proxy
const state = proxy({
text: ""
});
export default function App() {
const { text } = useSnapshot(state);
return (
<input
value={text}
onChange={(e) => {
state.text = e.target.value;
}}
/>
);
}
Live demo:
https://codesandbox.io/s/valtio-input-bug-el7l7
For some reason react input always jumps to the end of the field.
Try to type something, then change caret to anywhere else and type further.
Is Valtio doesn't work with controlled components or am I missing something?
Live demo:
https://codesandbox.io/s/valtio-input-bug-el7l7