Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Typescript - A spread argument must either have a tuple type or be passed to a rest parameter

$
0
0

I am having some problems with this error:

A spread argument must either have a tuple type or be passed to a rest parameter.

and my code looks like this:

  const [item, setItem] = useState<string>();  const [items, setItems] = useState([]);  const handleAddItem = () => {  console.log(item);  setItems(...items, item);}<TouchableOpacity onPress={() => handleAddItem()}><View style={styles.addWrapper}><Text style={styles.addText}>+</Text></View></TouchableOpacity>

I have searched the other questions posted about this topic but could not seem to fix it with any of those provided. Any ideas and inputs are appreciated!


Viewing all articles
Browse latest Browse all 6287

Trending Articles