I would like to prove that if $f(z)$ is an entire function that is real if and only if $z$ is real, then $f'(z)\neq 0$ for all real $z$.
I first wrote $$f(z)=u(x,y)+iv(x,y)$$ with $z=x+iy$ and expressed our hypothesis as $v(x,y)=0 \Longleftrightarrow y=0$. So we know that $v(x,0)=0$ for all $x$. It's not clear to me where to go from here though.
I also tried to come up with examples satisfying the hypothesis: one is to take $f(z)=z$, as then $f(z)=x+iy$ and of course the hypothesis is automatically satisfied. Of course, we also have $f'(z)\neq 0$ for all real $z$. A non-zero dilation of said identity function also works of course.
Any help is much appreciated.
EDIT: I am interested in ways of proving the statement other than those already written in the MSE links in the comment.