e1f19c52ab
* Dashboards in Group about page * Rename group dashboard to 'About Post' * Fixed James nits
14 lines
361 B
TypeScript
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
|
|
}
|