I am trying to make a memo pad where a user can write in a textarea and save it. When the page opens, I want the same text to remain in the textarea.
I don't want to use the onChange event because it gets rendered with every input
So I am trying to use onSubmit and useEffect.
I am new to react and trying to understand hooks. But after reading all the documents I am still lost.
I am using Ionic framework and below is my code,
<IonCard>
<form className="memo" onSubmit={handleSubmit(text)}>
<IonItemDivider><IonLabel>관리자용 메모판</IonLabel></IonItemDivider>
<IonItem>
<IonTextarea id="memoTextarea" rows={28} value={text} name="memoTextarea" ref={register({})} ></IonTextarea>
</IonItem>
<IonButton type="submit" fill="solid">저장</IonButton>
</form>
</IonCard>
Can anybody help me, how will I implement the useEffect code ?
useEffect(()=>{
}, []);
What do I put inside handleSubmit()?