Show a scheme is integral if and only if it is irreducible and reduced. I'm trying to solve Exercise 5.2.F from Vakil's notes:

Show a scheme $X$ is integral if and only if it is irreducible and reduced.

Where we say $X$ is reduced (integral) if $\mathscr O_X(U)$ is reduced (an integral domain) for all open subsets $U$ of $X$.
Clearly, if $X$ is integral, then each $\mathscr{O}_X(U)$ is a domain, hence reduced, so $X$ is reduced. I'm not sure how to see that $X$ is irreducible. It's obvious for an affine scheme, since if $\mathscr{O}_X(X)=:A$ is a domain then $\text{Spec } A$ is irreducible. Am I able to use this to tackle the general case? Like if $X=\cup_i U_i$ with each $U_i$ affine open, does each $U_i$ being irreducible imply that $X$ is irreducible? This doesn't seem like the right way to approach it.
I'm not sure, I just feel stuck. Any hints would be greatly appreciated (I'd prefer that over someone just giving me the answer).

If there were any disjoint open subsets $U,V$ then by the sheaf axioms $$\mathcal{O}_X(U \cup V) \cong \mathcal{O}_X(U) \times \mathcal{O}_X(V)$$ via restrictions $s \mapsto (s|_U, s|_V)$. This product has zero divisors of the form $(0,t)$ and $(t,0)$ unless one of $U$ and $V$ is empty. Contradiction since $\mathcal{O}_X(U \cup V)$ is integral.
This appears as Proposition 3.27 in Görtz, Wedhorn's Algebraic Geometry (which is a great reference for the basics of schemes).
