Depends on a lot on the hardware you bought and the upgradability of it. Buy a cheap laptop that's lower/mid tier, won't last as long. Buy a higher end laptop with upgradeable ram and storage, it will last years. Same for desktop pc's, if you went out and bought AM4 today, probably be harder to stretch it for as long on a dead platform. AM5? Yea, zero issues and its upgradable
Also depends what its being used for. A gaming pc? If you want to keep playing current gen games and want decent frames and settings, laptops definitely wont last as long, and even a desktop you'll eventually hit a hardware limitation with it