  For a simple graph $F$, let $\mathrm{EX}(n, F)$ and $\mathrm{EX_{sp}}(n,F)$
be the set of graphs with the maximum number of edges and the set of graphs
with the maximum spectral radius in an $n$-vertex graph without any copy of the
graph $F$, respectively. Let $F$ be a graph with
$\mathrm{ex}(n,F)=e(T_{n,r})+O(1)$. In this paper, we show that
$\mathrm{EX_{sp}}(n,kF)\subseteq \mathrm{EX}(n,kF)$ for sufficiently large $n$.
This generalizes a result of Wang, Kang and Xue [J. Comb. Theory, Ser. B,
159(2023) 20-41]. We also determine the extremal graphs of $kF$ in term of the
extremal graphs of $F$.
