This is the context for the question I'm having difficulty with.

And this is the question giving me trouble, followed by the solution provided by the teacher. This approach doesn't make much sense to me.
It seems like the limit of f(x) is evaluated from the left and the right of 0, and plugged into g(x), and again the limits of these are evaluated from the left and right of 0.
Am I misunderstanding something?
What I originally tried doing to solve this problem was using this kind-of substitution thing our teacher showed us but did not explain really well, and use it on the left and right side limits of $ \lim \limits_{x \to 0} g(f(x)) $
$$u = f(x) $$ $$as\ x \to 0^-, u\to 0 $$ $$ \lim \limits_{u \to 0} g(u) $$ And then this is $ DNE $ so I don't see any point in trying this on the right.
My teacher does not answer questions on homework and we haven't gone over this kind of problem before.

If $x<0$, then $f(x)=0$, so $g(f(x)) = g(0) = 0$.
If $x>0$, then $f(x)=1$, so $g(f(x)) = g(1) = 0$.
So, $\displaystyle \lim_{x \to 0^-} g(f(x)) = \displaystyle \lim_{x \to 0^-} 0 = 0 = \displaystyle \lim_{x \to 0^+} = \displaystyle \lim_{x \to 0^+} g(f(x)) = \displaystyle \lim_{x \to 0} g(f(x))$, and $g(f(x))$ is continuous, as $g(f(0)) = g(1) = 0 = \displaystyle \lim_{x \to 0} g(f(x))$.
Where you wrote $u \to 0$, should really be $u=0$.