input - textarea resized

PHOTO EMBED

Sun Jan 08 2023 20:31:43 GMT+0000 (Coordinated Universal Time)

Saved by @ITAG #javascript #react.js #input #resized

const textAreaResized = () => {
  const handler = (e) => {
    const target = e.currentTarget;
    target.style.height = "auto";
    target.style.height = `${target.scrollHeight}px`;
  };

  return <textarea onChange={handler} />;
};
content_copyCOPY

Voir le codeSandBox ici : https://codesandbox.io/s/textarea-resize-27kwsd?file=/src/App.js:84-94

https://codesandbox.io/s/textarea-resize-27kwsd?file=/src/App.js:84-94