score:1

Accepted answer

you appear to be missing a square bracket in your example code:

| null>(['')

should be

| null>([''])

change line 8 so you're also spreading the second array, and it fixes your problem:

setarr((prev: string[])=> [...prev, ...temparr])

Related Query

More Query from same tag