How often do you replace your desktop computer?

I got a Lenovo desktop All-in-One December 2014 when I was 16. It'll be 4 years old soon and I'm 20 now, but my few needs such as basic browsing and Office programs remain the same. It's starting to slow down and I;m wondering if I should switch now or milk it for all I can.

You might want to do some clean-up, or even a "factory reset" to restore its speed. (Back up your files, first.)

Four years old isn't very old for a desktop. I've got a bunch; my *newest* machine is seven years old. (Bought it used earlier this year. Dirt cheap. Works great.)

When it breaks down, I will replace that part

I have some 7 year old iMacs that are fast enough for me.
Mostly a slowed computer is caused by poor maintenance. Clean out dust, defrag the hard drive, limit what is loaded on startup.