Manufacturing of the components can be done pretty much anywhere, even incredibly high-tech components like CPUs (e.g. Intel has fabs in the US, Ireland, Israel and China, but also used to be in Malaysia, Vietnam, Costa Rica and so on). However, most component manufacturing is commodity stuff like capacitors or springs or whatnot. Very low profit and growth. It's not to say that China doesn't make a large number of those things, but those are even easier to manufacture pretty much anywhere and there's no real monopoly on those things in China and once they're automated it means that there's no specific reason they have to stay in China.
China manufacturers want to move up the value chain and thus are really doing final assembly of the components or sub-assembly work (with final assembly perhaps also being performed in China) of other people's designs. The next step up the value chain is of course to sell their own designs, and services around selling designs, and it's pretty clear that there's ample talent in China's domestic market to get there very soon.
Anyways, what makes money and grows is figuring out how to put the existing components together into novel products and then charge for profit for product demand. A capacitor might cost $.01, but in an iPhone that same capacitor might be "worth" $.03 as a fraction of the total sale price. It's better to be Apple selling 1,000,000 iPhones than to be the capacitor maker selling 1,000,000 capacitors because Apple gets to pocket the extra $.02.
The reason China has become such a major manufacturing center is because of two factors:
1) The raw components are readily available.
2) The labor is cheap.
As I've mentioned, #1 isn't really important for mass manufacturing. Over the decades similar major tech manufacturing centers have sprung up in quite a few places, for example Akihabara in Tokyo or Yongsan in Seoul. These places are now shadows of their former selves, but you can still go to Yongsan and buy 100,000 3" computer power supply fan motors for cheap if you really want to.
What made the whole thing work in China is #2 - cheap labor. And that exactly why it used to work in Japan and then Korea. But the economy got better in those places and the labor got less cheap. It's why Akihabara mostly just sells used stuff and video games and nobody really buys computers and radios at Yongsan anymore. The labor market is just simply got too expensive to keep employed manually soldering tiny components together.
Folks I know now say that things aren't so cheap in Shenzhen anymore. Facilities cost as much as any first-world country, and labor is getting to be Eastern European levels or higher. The availability of components is still unstoppable, but that only exists because the manufacturers exist and that only exists because the labor was cheap. Which means Shenzhen is becoming more and more of a good place to rapidly prototype and engineer designs for manufacturing...but is starting to feel less and less like the place you want to do the final factory work for a million copies of the thing you just designed.
Once the labor pool prices itself out, the ubiquitous availability of parts will eventually dry up and it will no longer be the manufacturing paradise it was and won't even be a great place to design stuff. So where does it move to? I don't really know, but you need a good combination of:
a) poor to not wealthy
b) reasonably well educated
c) ability to move materiel in and out
d) not a global pariah
e) a culture of hard work
f) not lots of other natural resource traps to focus the economy on
I think there will be a few years of fooling around with repatriating some manufacturing in the U.S., but the conditions here are bad for electronics manufacturing. So I think it'll eventually settle for a generation in maybe SE Asia or somewhere in Latin America. Wildcards might be Eastern Europe (maybe Poland, Slovakia, Czech, Hungary) or or a few places in Africa (Kenya, Ethiopia, South Africa, etc.).
Or even more intriguing, the countries that China has focused their Belt and Road program on -- after all China will need a future China to make cheap stuff for them!