Here, you want to find the GCF, or the greatest common factor.
Simplest way to do this is by listing out all the factors.
30: 1, 2, 3, 5, 6, 10, 15, 30
42: 1, 2, 3, 6, 7, 14, 21, 42
So the greatest number that they share is 6.
So there would be 6 picnic baskets. (With 5 sandwiches and 7 cookies in each)