When Australia started to get closer to the US, China put blocks on imports, delayed customs clearance for food (so it spoiled), hoping to break Australia away from the Western Alliance.
When Macron wanted to visit China, he was welcomed with open arms.
China knows they can't go up against the entire Western world, but if they can peel off each country - one by one - they can go up against the US alone (or think they can), whether it be economic or military warfare.