If $f \circ g$ is one-to-one, is $f$ one-to-one? I said:
$X,Y,Z \subseteq\mathbb{R}$
$$
g:X→Y, f:Y→Z\\
g(x)=\sqrt x,\quad f(x)=x^2
$$
so $f(g(x))=x$
Therefore $f(g(x))$ is one-to-one but $f(x)$ is not.
Is this the correct approach?

For a more trivial example, let $g: \{1\} \to \{1,2\}$, $f: \{1,2\} \to \{1\}$. Then $fg$ can't help but be the identity function on $\{1\}$, but $g$ can't be surjective, and $f$ can't be injective. (As others have pointed out, your example doesn't work.)
