Random connectivity problems with Apple Magic Mouse

I had random connectivity problems with Magic Mouse. The problem was present both with the old Magic Mouse and the new Magic Mouse 2.

After trying all sorts of solutions that I found online, nothing worked but I found several mentions of interference with WIFI 2.4GHz. It didn’t make much sense in my head since Magic Mouse uses Bluetooth but in fact changing to a network using WIFI 5GHz solved the problem.

To check the WIFI details on MacOS press alt/option while you click the WIFI icon on the Menu Bar.