You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And a simple input component to the CounterHook component:
constCounterHook=()=>{const[{ count, name },{ increment, setName }]=useCounter();return(<div><h3>With Hooks</h3><p>{count}</p><p>{name}</p><buttononClick={increment}>+1</button><inputvalue={name}onChange={e=>setName(e.target.value)}/></div>);};
If text is added to the beginning, or middle of the name field, the first character will be correct, but the caret will jump to the end of the text after a single entry.
This is not the behaviour if I make a local state using React.useState
Using the basic-flow example and adding a name to the state:
And an action to set the name:
And a simple input component to the CounterHook component:
If text is added to the beginning, or middle of the name field, the first character will be correct, but the caret will jump to the end of the text after a single entry.
This is not the behaviour if I make a local state using
React.useStateHere is a video of the behaviour:
Screen.Recording.2022-09-22.at.12.38.05.PM.mov