Load different components for Mobile and Desktop
npm install react-device-identifierA lightweight library for loading components on the basis of device detection.
If you don't find overhead of debugging such scenarios in their respective device resolutions like Tablets, Mobile or Desktop I highly recommend to use library react-device-detect instead of this one.
javascript
import DeviceIdentifier from 'react-device-identifier';
`Run component only on Desktop
`javascript
// Desktop Component goes here
`
Run component only on Mobile
`javascript
// Mobile Component goes here
`Run component only on Tablet
`javascript
// Tablet Component goes here
`Run component for Mobile & Tablet
`javascript
// Tablet & Mobile Component goes here
``We can make this more granular and can introduce more options like detecting low resolution tablets, But for now I kept it simple and covers the basic scenarios.
Feel free to send out pull request or can contact me directly via my eamil id nairabhijit6@gmail.com