norden.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Moin! Dies ist die Mastodon-Instanz für Nordlichter, Schnacker und alles dazwischen. Folge dem Leuchtturm.

Administered by:

Server stats:

3.5K
active users

#reactjs

1 post1 participant0 posts today
Continued thread

I'm aware that in ReactJS v19 they got rid of forwardRef, thankfully, and we can just pass the ref as a prop.

Still, after-thought on top of after-thought to abstract complexity they created in the first place in 15 years of software development.

That's how I feel about #ReactJS

Continued thread

So I made a diagram to showcase how to implement a Modal component that holds a dialog, which expose the dialog's methods "showModal()" and "close()", forwards them to the main App component, that passes those to a button as props.

The modal component also needs a portal that makes sure its own html will end up in the body outside the main app, and therefore above everything on the screen.

Just to answer the question of why do you need all those hooks for a dialog modal in
#ReactJS.

Continued thread

So basically there's people working on the HTML standard that are very thoughtful and add a great quality of life and accessibility new feature like the <dialog> element and then there's people that to use it properly inside a front end framework have to write the most convoluted and unfriendly code ever...

in a nutshell...

Do you need another example of how #ReactJs complicates #webdev for its own sake?

I spent the day implementing a modal with a dialog element inside that works correctly (and still I had to use CSS to center it for god knows what reason at this point).

I literally need to draw a diagram to explain all the flow, it's horrendous!
It involves useRef, forwardRef, imperativeHandle, createPortal just on the Modal component. And a bunch of stuff passed around other components...

For fuck sake...

Happy Monday!

I believe that if you start the week by removing code is a good start of the week!

I learned how to leverage JWT to send encrypted data to the frontend.
And so I stripped down my system of hooks in React and also deleted completely an endpoint in Django that I was using solely to fetch user info.

Even more secure, with less code.