react-tag-input-component icon indicating copy to clipboard operation
react-tag-input-component copied to clipboard

Bug: types for value is optional but actually required

Open namhong2001 opened this issue 2 years ago • 0 comments
trafficstars

https://github.com/hc-oss/react-tag-input-component/blob/861e4e760d080d418724bd63d84e9288617ff082/src/index.tsx#L47 Here the code seems considered undefined value but below code makes the tags undefined and make throw error. https://github.com/hc-oss/react-tag-input-component/blob/861e4e760d080d418724bd63d84e9288617ff082/src/index.tsx#L53-L57

IMO current code is not support uncontrolled component, so it would be good to have value and onChange props required

Someday for uncontrolled component may be form of

<form onSubmit={(e) => {
  e.preventDefault();
  const formData = new FormData(e.currentTarget);
  const tags = formData.get("tags"); // should be such like ["banana", "apple"]
}}>
  <TagsInput name="tags" />
</form>

namhong2001 avatar Dec 28 '22 03:12 namhong2001