fireship.io icon indicating copy to clipboard operation
fireship.io copied to clipboard

courses/react-next-firebase/admin-forms/

Open utterances-bot opened this issue 2 years ago • 7 comments

Post Editing Form

Use react-hook-forms to create a form to edit posts in markdown

https://fireship.io/courses/react-next-firebase/ssr-profile-page/

utterances-bot avatar Jul 30 '22 00:07 utterances-bot

can't make this page work. All I get is an empty page with no error thrown

marcelofrayha avatar Jul 30 '22 00:07 marcelofrayha

I currently face the same issue. When doing const [post] = useDocumentData(postRef); post returns undefined.

bbissm avatar Aug 09 '22 17:08 bbissm

I Solved it. Check in firebase if the id of your post is same as the slug. It should be for example hello-world instead of hJyyEuKAVlg9TFVIVlGx

bbissm avatar Aug 09 '22 18:08 bbissm

If any of you are getting the error " Type Error: path.split is not a function ". Then you must change the useForm register hook to the new updated verson. {...register("NAMEHERE")} instead of ref={register}

    <fieldset>
      <input
        className={styles.checkbox}
        name="published"
        type="checkbox"
        {...register("published")}
      />

JimboTron9000 avatar Aug 10 '22 01:08 JimboTron9000

@marcelofrayha how you fixed it because i'm having the same issue

Casal0x avatar Sep 16 '22 15:09 Casal0x

@bbissm can you explain a bit more I am facing the same issue and seem like I got my post id same as slug already but post still return 'undefined'

toppyc4 avatar Sep 22 '22 07:09 toppyc4

I am currently facing the same issue. The problem is useDocumentDataOnce function make the 'post' variable return 'undefined' Right now I still can't find the solution, but the quick-fix, as mention in https://github.com/CSFrequency/react-firebase-hooks/issues/252, is to use useDocumentData instead. Hope it help.

toppyc4 avatar Sep 23 '22 05:09 toppyc4