import { ref, onValue } from 'firebase/database'
export default function EntitityPage({ entityId }) {
const [ entity, setEntity ] = React.useState(null)
React.useEffect(() => {
const unsubscribe = onValue(ref(db, 'entities/' + entityId), (snapshot) => {
setEntity(snapshot.val())
})
return () => {
unsubscribe()
}
}, [entityId])
return (
<div>{JSON.stringify(entity)}</div>
)
}