Many people stress energy and airspeed management, this is a good example.
Sometimes a strong gust can reduce airspeed faster than your engine can increase it.
The sudden tail wind gust is very dangerous near the ground. Increase throttle and pitch down. Use your potential energy plus the engine thrust to maintain airspeed. Wind conditions found in microbursts can create this effect. Constantly check airspeed.
A strong headwind gust has the opposite effect, causing a momentary increase in airspeed, and increase in altitude. Rarely a problem, keep an eye on airspeed as the gust passes, continue to use pitch and power to control airspeed and altitude as needed.
Side gust effect will affect your heading much more than speed and altitude, as it's velocity change does not add or subtract from airspeed. Effects here could include a sharp roll initially away from the gust, and the nose being pushed into the wind from side force on the empennage. A stable plane should mostly self-recover without significant loss of altitude.
The mantra "the plane just moves with the air mass" does not apply to gusts. This is why pilots generally approach at slightly higher airspeed under those conditions.