import React from 'react'
import { useSelector } from 'react-redux'

export default (props) => {
  const { role } = props

  const { person } = useSelector(s => s.user.userInfo)
  const { personType } = person || {}
  const isSame = personType === role

  return isSame ? props.children : null
}
