Hello
Does this only happen to WhatsApp, or have you tested the built in Camera app from Windows and see if it works there?
If it only happens to WhatsApp, go to Windows Settings > Privacy & security > Camera, make sure the permission is on, and also it is on specifically for WhatsApp.
Also check in app settings in WhatsApp to see if there's any settings related to camera, to make sure it is allowed.