Here's a React hook that checks if the user's device has a rear facing camera
Here's a React hook that checks if the user's device has a rear facing camera.
Technique: Use the browser's getUserMedia API to check if facingMode="environment", which means a camera exists that faces away from the user. 😎
(Use the image's alt tag to copy the actual code).

To check for a front facing camera, check for a facingMode of "user".
More details on MDN: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia