Created
December 29, 2021 02:49
-
-
Save 0916dhkim/de39075ddd5e03a942b3657a2aac7add to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function NewPost() { | |
const navigate = useNavigate(); | |
const invalidateCache = useCacheInvalidate(); | |
// ... | |
/** @type React.FormEventHandler */ | |
const handleSubmit = async (e) => { | |
e.preventDefault(); | |
await createPost({title, content}); | |
invalidateCache('/posts'); | |
navigate('/posts'); | |
}; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment