I think the lesson China will be taking from Ukraine is that it’s incredibly hard to invade and occupy a country with the capacity to resist. As far as invasions go, Russia’s invasion of Ukraine is about as easy a scenario as you can imagine.
A country that borders right next to you, that you surround on 3 sides, mostly completely flat. The fact Russia has completely stalled and taken incredibly high losses would make even the most hawkish Chinese decision-maker pause for thought. Russia also has much more experience of using its armed forces and developing doctrines before this years invasion, something modern China has never done.
If you have all that going for Russia, and they have really struggled, then you have a much tougher task ahead for China, where they need to perform an ambhimbious invasion. As
@Wizaard points out, these are incredibly difficult. Probably the hardest thing you can pull off in modern warfare. With the advancement of antiship missiles I’m not entirely sure they’re feasible anymore. Even then once the landing is complete you have to take the island which is densely populated, and where it isn’t densely populated it’s mountainous. Again Ukraine has shown it’s incredibly costly to take cities, and Afghanistan shows how mountains can make occupation efforts a nightmare.
I would say though that Taiwan much is smaller than Afghanistan or Ukraine, which does make things slightly easier but not enough to outweigh the other factors.
I think a realistic scenario is that China would blockade Taiwan rather than try full on invasion, similar to the US in the Cuban missile crisis. I have no clue how the US would react to that. A blockade would be much less costly, and also shows why they’re so keen on building military infrastructure in the sea and claiming islands wherever possible.