summaryrefslogtreecommitdiff
path: root/src/core/components/views/MobileView.jsx
blob: 0c8a806cdd14f477186469b29a5e0af4101cc150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import useDevice from '@/core/hooks/useDevice'
import { useEffect, useState } from 'react'

const MobileView = ({ children }) => {
  const { isMobile } = useDevice()
  const [view, setView] = useState(<></>)

  useEffect(() => {
    if (isMobile) {
      setView(children)
    } else {
      setView(<></>)
    }
  }, [isMobile, children])

  return view
}

export default MobileView