1.0.3 • Published 1 year ago

simple-contenteditable v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

simple-contenteditable

A tiny contenteditable controlled component for React. Pass the value and ref as a prop to the component. Example:

const [text, setText] = useState('');
const inputRef = useRef(null);

function handleInput(e) {
  console.log(e.target.innerText);
  setText(e.target.innerText);
}

return (
  <div>
    <ContentEditable
      inputRef={inputRef}
      inputValue={text}
      handleInput={handleInput}
    />
  </div>
);