In a chemical reaction, the law of conservation of mass states that matter cannot be created or destroyed. This means that the total mass of the reactants must equal the total mass of the products.
In the reaction you provided:
\[ \text{CaCO}_3 \rightarrow \text{CO}_2 + \text{CaO} \]
When 30 grams of calcium carbonate (\( \text{CaCO}_3 \)) is heated, the total mass of the products (carbon dioxide (\( \text{CO}_2 \)) and calcium oxide (\( \text{CaO} \))) will also be 30 grams.
Thus, the answer is:
30 grams.