The Wii U main feature is that you can play on the Wii U gamepad screen instead of using the TV screen, but it's not really portable since it still needs the console. It essentially created a feature that has no practically use while other console Nintendo made were better. Why would anyone use the small gamepad screen at home when you could use the large TV screen? If gamers wanted living room TV gaming experience, they get a Wii. If they wanted it to be portable, they get a 3DS. Even the numbers explain it.
Also, Nintendo's attempt to put games on Wii U were mostly failure. This is not because the games on Wii U were bad, but the use of the gamepad (main feature) is still an impractical turd for most of those games. So any gamers who got the chance would buy the Wii or 3DS version game, skipping the Wii U version completely. To step right onto the Wii U gravestone, the rise of mobile game market didn't help drive Wii U sales at all. At worst, the mobile game market further reduced Nintendo overall potential new customers.
Switch on the other hand main feature is a portable console that can also be played using the TV screen. At the very least, this feature is a plus compare to the Wii and the 3DS. Here Nintendo did two things right.
Number one is drive up hype with the new game, Breath of the Wild, released on the Switch first. This works well because the game itself is good and game is what drive console sales after all.
Number two is console support for developers. For the first time, Nintendo made it easier for developers to make games on their console. This at least creates a level ground on par with the mobile game market which already has devices support for developers, and it quickest flooded the Switch store with a lot of games for gamers. Now all Nintendo needs to do is to keep up with the flow of game hypes with their exclusives, and they will continue to success.