Recall the definition of limit
Let $X$ and $Y$ be metric spaces; suppose $E\subset X$, $f$ maps $E$ into $Y$, and $p$ is a limit point of $E$. We write $f(x)\rightarrow q$ as $x\rightarrow p$, or $$\lim\limits_{x\rightarrow p}{f(x)}=q$$
if there is a point $q\in Y$ with the property: For every $\varepsilon>0$ there exists a $\delta >0$ such that $$d_{Y}(f(x),q)<\varepsilon$$ for all points $x\in E$ for which $$0<d_{X}(x,p)<\delta$$
Recall the definition of continuity.
Suppose $X$ and $Y$ are metric spaces, $E\subset X$, $p\in E$, and $f$ maps $E$ into $Y$. Then $f$ is said to be continuous at $p$ if for every $\varepsilon>0$ there exists a $\delta>0$ such that $$d_{Y}\left(f(x),f(p)\right)<\varepsilon$$ for all points $x\in E$ for which $d_{X}(x,p)<\delta$.
If $f$ is continuous at every point of $E$, then $f$ is said to be continuous on $E$.
The symbols $d_X$ an $d_Y$ refer to the distances in $X$ and $Y$ respectively.
Hint:
If $f:\mathbb{R}\rightarrow \mathbb{R}$ is continuous at $a$ if and only if $\lim\limits_{x\rightarrow a}{f(x)}=f(a)$.
Now, assume(the existence) that $\lim\limits_{x\rightarrow 0}{g(x)}=l$ and that $f$ is continuous at $l$. Using continuity of $f$ at $l$ ....
When $\lim\limits_{x\rightarrow 0}g(x)$ does not exist, then the right hand side of the the equation becomes vague.
On a side note, $\lim\limits_{x\rightarrow 0}{f(g(x))}$ can exist even when $\lim\limits_{x\rightarrow 0}g(x)$ doesn't. The simplest example is $f$ being a constant function and $g$ be any function discontinuous at $0$(and defined in some neighborhood of $0$).