I'm no expert when it comes to data storage but my understanding is that the jury is still out on long term data storage for SSDs.
For medium term (a few years) SSDs, which have no moving parts, are more reliable and less prone to error than HDDs.
If you have important data stored on HDDs, best practice is to get them out and spin the drive every few months. The moving parts at high speed (5400 or 7200 RPM) and low tolerances mean that they can seize up if left idle. Their magnetic storage also makes them fragile. I've got a cupboard full of hard drives with client data stored and it makes me nervous. Every now and then I'll pull out a drive to access some files and the drive has failed. That's why whole businesses are dedicated to data recovery - costs a bomb.
For a while there back in the 90s, the conventional wisdom was that CDs and DVDs would be the best option for long term storage -for the same reason, no moving parts - but they proved to be prone to
Disc Rot and other problems. I'm sure we've all opened up a CD that hasn't been played for a few years and noticed errors.