4 ms·
Congrats on the launch, looks neat! > and b) building my own frontend (probably via React, and then maybe via formik) There's also a new technology called HTM
by rmbyrro 3y ago
Congrats on the launch, looks neat!
> and b) building my own frontend (probably via React, and then maybe via formik)
There's also a new technology called HTML. It comes with a <form> tag, <input> field tags, and even a <button> to submit!
Although new, they managed to get all browsers on board to support it.
You will not need to import 150kb of JavaScript, though, which is sad. And it's not shiny to speak about in the interview for your next job.
I guess the pros dont overweight these cons... Yes, "probably via React" is the way!
- pantulis 3y agoLet me tell you something about this fancy HTML tag you are talking about. It has an "action" attribute that points to a server you need to own and run a code you need to code in order to validate the input and store it in the database. If you are comfortable doing this, which no doubt you are, then you are not the target audience of this tool.
- hk__2 3y ago> It has an "action" attribute that points to a server you need to own and run a code you need to code in order to validate the input and store it in the database Pure-HTML forms work exactly like React forms; React does the lifting but it doesn’t change anything to the fact that the data eventually needs to be sent to a server to be stored in the database.
- _heimdall 3y ago> Pure-HTML forms work exactly like React forms This should probably read "React forms work exactly like pur-HTML forms" seeing as HTML came first and react ultimately spits out either an HTML form or a form request. The original point still remains though, reaching for react just for forms is really heavy handed. It works fine if everything on the site is react already, though that's an assumption that I wouldn't make and that I hope will die soon enough if devs finally start moving away from massive react apps.
- rmbyrro 3y agoLet me tell you something else. If you read the comment again, you'll see I'm replying to OP's scenario of setting his own server and frontend. I'm questioning the "probably using React" part of the frontend because... it's an overly complex solution to an already elegantly solved problem?
- rajamaka 3y agoWhy do people here commonly imply downloading 150kb of data is an issue in the current year?
- hk__2 3y agoBecause it is. It can be very frustrating not to be able to fill a form on mobile with a 3G connection just because some random dev decided that downloading 150kb of JS to render a simple form is fine. I mean it’s a form; we already have all the HTML elements already; why do you need React for? This is why nowadays we end up with Electron apps that take 6GB of RAM to display a chat.
- throwaway60320 3y agoIt's really not that simple. What about complex validation rules? Do you really think it's user friendly to require them to send the whole form just to tell them "sorry no" 10 times over until they get it right? What about multi-value selects, potentially with rules? E.g. form field like "choose up to 5 locations in the radius of 10km". What about form fields like "pick a point on a map"? Etc. Don't act like every form is 5 simple text inputs.
- rmbyrro 3y agoDoing validation in the frontend is a bad idea. You'll have to do in the server, if you're sane. I bet Retool Forms does in the server. You're worried the page will refresh with an empty form, if it fails. It's simple, just collect the data and return the form pre-filled using the value attribute, along with the error message. If you don't want to refresh the page, you could even use something like htmx, which is a LOT simpler than React, but really not necessary for simple form submission.
- throwaway60320 3y agoOf course you have to validate on the server. That's a given, always. But you want to provide better UX to the user. Htmx is not simpler than React. I can't deploy that without a server that knows everything about the frontend. React allows me to decouple. Templates are hell. I lived in it for many years, never again.