I have a very basic question, sorry for that )=. Let's fix some notation first. Let $ dz = dx + i \; dy $ . Given $f \in C^1$, $f : D \subset \mathbb C \to \mathbb C$, we define $df = f_x \; dx + f_y \; dy$.
Now, note that $f(z) \;dz = (u+iv)(dx+i \;dy) = ( u \;dx - v \;dy ) + i (u \;dy + v \;dx ) = w_1 + iw_2$.
Using this it's easy to see that if $F_j$ is a primitive of the form $w_j$ ($j=1,2$), then $F_1 + F_2$ is a primitive of $w_1+iw_2$. Using this, my book says that if $f(z)\;dz$ is closed , then $u,v$ satisfy Cauchy-Riemann $(f=u+iv)$. I don't understand why.