const getUserRole = () => 'admin'
const Authority = ({ value, children }) => {
const [hasAuthority, setHasAuthority] = useState<boolean>(false)
useEffect(() => {
const checkAuthority = async() => {
const userRole = await getUserRole()
setHasAuthority(userRole === value)
}
checkAuthority()
}, [value])
if (hasAuthority) {
return <div>{children}</div>
} else {
return null
}
}