If using dried rice cakes, pre-soak them in water for about 3h or overnight in the fridge. After soaking for 30 minutes, carefully separate the rice cakes so they are not stuck together. Drain soaking liquid before cooking.
Add the ingredients for the sauce in a small bowl and whisk together until the sugar has completely dissolved.
Heat a wok or large frying pan on high and add the oil. Once the pan is hot, lay the tofu pieces down and cook about 15 minutes, flipping halfway, until both sides are browned. Set tofu aside.
Add the mushrooms and saute until the mushrooms have browned slightly, 2-3 minutes.
Next, add the sliced onions and most of the green onions (save some for garnishing) to the pan and stir fry for a few minutes until the onions are translucent.
Add in about 4 tbsp of the sauce and the drained rice cakes. Stir fry the rice cakes for 3-5 minutes.
Add the spinach and the rest of the sauce (if needed or desired) and stir fry everything for another 2-3 minutes, until the spinach has wilted and the rice cakes are soft and chewy. Taste a rice cake to be sure they're fully softened.
Serve immediately and top with more green onions.