'React-native-tags-input implemented with hooks
I'm using react-native-tags-input library from npmjs and I found an example for using it in a React Class component, but I want to use it in a stateless(function) component. That's the big problem. I don't understand how to make this library to work in a stateless component. Here's a snippet from my code:
import TagInput from "react-native-tags-input";
const chooseTags = () => {
const [chips, setChips] = useState({
tag: "",
tagsArray: ["first", "second"],
});
const updateTags = (state) => setChips({ ...chips, state });
return (
<View>
<TagInput updateState={() => updateTags} tags={chips} />
</View>
);
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
