import useDevice from '@/core/hooks/useDevice'
import { useEffect, useState } from 'react'

const initialView = <></>

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

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

  return view
}

export default MobileView
