Next.js Discord

Discord Forum

Form components in next: Unexpected token `form`. Expected jsx identifier

Unanswered
Great-tailed Grackle posted this in #help-forum
Open in Discord
Great-tailed GrackleOP
Hi yall, I'm getting this issue with a form on my next project, just wondering if i'm missing something?

return (
    <form onSubmit={handleSubmit} encType="multipart/form-data">


Import trace for requested module:
./app/hub/create/page.tsx
 GET /_next/static/webpack/f7792399525316dc.webpack.hot-update.json 500 in 224ms
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
 GET /hub/create 500 in 4ms
 ⨯ ./app/hub/create/page.tsx
Error:   × Unexpected token `form`. Expected jsx identifier
     ╭─[/Users/tgill/dev/print/app/hub/create/page.tsx:115:1]
 112 │ 
 113 │   // Form UI
 114 │   return (
 115 │     <form action={handleSubmit}>
     ·      ────
 116 │       <div className="row container-fluid mt-3">
 117 │         {/* Show debugging info */}
 118 │         <div className="mb-3">
     ╰────

Caused by:
    Syntax Error


been bashing my head against a wall for atleast an hour now trying to fix this. any ideas?

12 Replies

West African Lion
have u tried removing encType?
Great-tailed GrackleOP
right.... that may be the case
West African Lion
why r u using it?
Great-tailed GrackleOP
i thought i needed it cuz i wanted to restrict file upload type, but it was silly
West African Lion
that's fine, please mark this as solved
@Losti! have you tried the form without the encType?
Great-tailed GrackleOP
Yeah
results?
Great-tailed GrackleOP
we good
thx
perfect!
Great-tailed GrackleOP
:3