When prepositional phrases are used in a parallel series, prepositions (with, to, of, over, under, by, etc.) should be repeated with every element of the series unless all elements use the same preposition. A common error is to repeat prepositions unnecessarily, resulting in a stilted style.
In this sentence, there are three prepositional phrases complementing I am making a stew. If written separately and not in a single, parallel structure, they would read:
I am making a stew with carrots.
I am making a stew with onions.
When combining these elements into a single sentence, there is no need to repeat the preposition with because it is used identically for each element.
Writing the sentence this way ensures a clear, uncluttered style.
What to Avoid: Mixing Prepositions in a Parallel Structure
Mixing prepositions improperly in a parallel structure is a common writing mistake. If a writer allows multiple phrases to share a preposition and then introduces a different preposition with another element, the result is a clumsy sentence.
If we separate the elements of this sentence, we have:
The baby flung spaghetti strands on the counters.
The baby flung spaghetti strands under the table.
The first two elements require the preposition on, but the last element requires the preposition under. Therefore, it is necessary to repeat all three prepositions when combining the elements into a parallel sentence structure.
from Grammarly Blog https://www.grammarly.com/blog/parallel-structure-prepositions/