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
