score:0

Accepted answer

you need to return an array or object in divide:

return { maindish, deseret, firstdish };

and you can get 3 new arrays like this:

if(products) { 
  const { maindish, deseret, firstdish } = divide(products)
}

score:0

you can return an object containing three arrays from the divide function like this

const divide = () => {
  ...

  return {maindish , deseret , firstdish}
}

and then utilize it in the component like this {maindish , deseret , firstdish} = divide(products).


Related Query

More Query from same tag