manifold/web/hooks/use-post.ts
FRC e1f19c52ab
Post in a group about page. (#803)
* Dashboards in Group about page

* Rename group dashboard to 'About Post'

* Fixed James nits
2022-08-30 13:39:10 +01:00

14 lines
361 B
TypeScript

import { useEffect, useState } from 'react'
import { Post } from 'common/post'
import { listenForPost } from 'web/lib/firebase/posts'
export const usePost = (postId: string | undefined) => {
const [post, setPost] = useState<Post | null | undefined>()
useEffect(() => {
if (postId) return listenForPost(postId, setPost)
}, [postId])
return post
}