score:2

Accepted answer
setCompanies([...companies, ...fetchedCompanies.filter(com => !com)]);

score:0

prevCompanies.concat(fetchedCompanies).filter(Boolean)

score:1

setCompanies([...companies, ...fetchedCompanies]);

Related Query

More Query from same tag