Let $G$ be a finite group and $V$ an $n$-dimensional linear representation of $G$, then $G$ acts on the dual representation $V^*$ by $gf(v) = f(g^{-1}v)$, hence induces an action of $G$ on the polynomial ring on $V$, denoted by $k[V]$. A polynomial $P \in k[V]=k[x_1,x_2,\ldots,x_n]$ is invariant under $G$ if $gP=P$ for all $g\in G$.
Claim: A polynomial $P \in k[V]$ is $G$-invariant if and only if its homogeneous components are $G$-invariant.
Proof: Suppose its homogeneous compoenents are $G$-invariant, then $P$ is clearly $G$-invariant. Now suppose $P$ is $G$-invariant, consider a monomial $x_1^{e_1}x_2^{e_2}\ldots x_n^{e_n}$, then identifying $G$ with a subgroup of the symmetric group $\mathfrak{S}_n$, $G$ acts on the monomial by permuting variables hence preserve the degree of the monomial, this implies $G$ acts on $k[V]$ by degree preserving automorphisms, hence by the assumption that $P$ is invariant under $G$, by comparing degrees of the homogeneous components, we have that each homogeneous component must have been fixed by the action of $G$ as well.
Can someone comment on my proof whether it is valid please?
The converse argument is not valid: Firstly, $G$ can be identified with a subgroup of $S_n$ if it is finite, which may not be true in this case. Even if it is finite, then it may not act on the monomial by permuting the variables. But, as you said, $G$ acts on the degree one homogeneous elements $k[V]_1=V^*$ of $k[V]$ which implies that if $f=\sum_{\alpha} x_1^{\alpha_1}x_2^{\alpha_2}\dots x_n^{\alpha^n}$ then $g\cdot f=\sum_{\alpha} (g x_1)^{\alpha_1}(g x_2)^{\alpha_2}\dots (g x_n)^{\alpha_n}$ and each $g x_i$ is in $k[V]_1$, i.e. of degree $1$. Thus, the degree of $f$ is preserved. Here, I used the fact that 1) $G$ action on $k[V]$ is linear, i.e. $g (f+h)=g f+gh$ and 2) it is multiplicative, i.e. $g(fh)=(gf)(gh)$. Both can be proven using the definition of the action of $G$ on $k[V]$: $(gf)(v)=f(g^{-1}v)$.