You mean the Shimano pattern freehub?
This is much better than a freewheel cluster because the ratchet is separate from the sprockets, so when your sprockets wear out you don't have to replace the ratchet. This means they could make the ratchet much more expensive and
higher quality than is practical in a freewheel cluster.
It also means you have bearings nearer the end of the axle which should eliminate the problem of bent axles as long as the bearings are maintained. It's the best thing ever!
You need a Shimano pattern cassette (the most common type of cassette by far), or single speed for cassette hub "single speed converter kit" which is just a couple of spacers and a sprocket.
You also need a cassette lock ring (male thing that screws into those internal threads) but that should be included with your cassette.
Sheldon says (and I had to correct my post with this QUOTE after fact checking my comments on Sheldon's article)
"Also, hubs marked "8-speed", "9-speed" or "10-speed" will work with any number of sprockets up to 10! (Add a 4.5 mm spacer before installing a 7-speed cassette on an 8-, 9-, or 10-speed hub, and the included 1-mm spacer before installing a 10-speed cassettes on an 8- or 9- speed hub.) Any of these cassettes will work with an 11-speed hub with the addition of another 0.85 mm spacer. 1.85 mm spacers are available so a 10-speed cassette will work on an 11-speed hub. Mavic's Shimano-compatible hubs will work with any number of sprockets up to 11, if you use the necessary spacers.
8 or 9 sprockets can be installed on a 7-speed hub, using 9- or 10-speed spacing. It is also possible to transplant an 8- 9- 10-speed cassette body onto most 7-speed Freehubs."
There must be no side to side play after the lock ring is tightened otherwise it will not change gears properly, or at all in the worst case.
As usual Sheldon Brown has written an article explaining the freehub, with more information than I could include in my post, although he often doesn't cover all the newer developments because he died quite some time ago.
https://www.sheldonbrown.com/k7.html