Hanging leg raises and knee raises are a tough exercise for a multitude of reasons.
It requires quite a bit of grip strength to hold your body up (this is quite a good thing if you are interested in improving such a thing)
It is utilising the abdominals and hip flexors from a completely stretched position, which can improve hip and leg drive in running, sprinting, kicking, and various other sporting movements.
If you struggle with your grip failing before your abs and hip flexors, try using chalk or straps. Maybe even use chalf for the first few sets, then as your grip gives out, switch to straps!