News for hackers. Stuff that matters.
Re:It's React, but in Python by uhtred on Tuesday June 06, 2023 @01:11PM (#36215980)
I thought generating html from function calls went out with the dinosaurs. We back doing it again?
Re:It's React, but in Python by loloquwowndueo on Tuesday June 06, 2023 @01:16PM (#36216040)
Re:It's React, but in Python by uhtred on Tuesday June 06, 2023 @02:34PM (#36217156)
I haven't used htmx but it looks nothing like pyreact. htmx is about adding attributes to html, so again, you are still writing html.
Re:It's React, but in Python by loloquwowndueo on Tuesday June 06, 2023 @03:58PM (#36218313)
Htmx is not only about adding attributes to HTML :) check how responses to requests are expected to contain full or partial HTML instead of, say, json.
Re:It's React, but in Python by uhtred on Tuesday June 06, 2023 @04:14PM (#36218509)
yeah I get that, but the html that is returned from the server doesn't have to be generated with things like html.div(html.p('hello this is a p tag inside a div'))

you could still have your html in a template file and parse and return the contents of that.

Re:It's React, but in Python by recursive on Tuesday June 06, 2023 @01:39PM (#36216368)
I mean, react does it. It never left. JSX compiles to function calls.
Re:It's React, but in Python by uhtred on Tuesday June 06, 2023 @02:32PM (#36217148)
yes but no one generates html from the function calls directly in react (even though you could if you wanted), they use jsx which is at least a bit like writing html.
Re:It's React, but in Python by neurostimulant on Tuesday June 06, 2023 @03:10PM (#36217649)
Re:It's React, but in Python by acemarke on Tuesday June 06, 2023 @03:33PM (#36217981)
That page is very out of date. They did later adopt a build step and switch to using JSX in much of the FF DevTools codebase.

As an example, here's the Editor main component (same "latest" commit you pointed to):

https://github.com/mozilla/gecko-dev/blob/aec3a901e6f6b3041b...

The codebase is a mish-mash of very old-style React+Redux code, with newer files and usages.

(I know this because I work at Replay.io, which started as a fork of the FF DevTools source, and we spent all of last year modernizing our fork :) Migrated the entire codebase to TS, ripped out all remaining uses of the ancient `React.DOM` helper functions and converted those to JSX, modernized the 2015-era Redux logic, etc: https://github.com/replayio/devtools/pulls?q=is%3Apr+sort%3A... )

Re:It's React, but in Python by neurostimulant on Wednesday June 07, 2023 @12:43AM (#36222918)
You're right, I totally missed they have tsconfig which include jsx preprocessor now. Too bad the devtools contributor documentation is not updated anymore, mozilla devs are probably stretched too thin to update obscure docs these days.
Re:It's React, but in Python by cantSpellSober on Tuesday June 06, 2023 @01:24PM (#36216140)
Why?
Re:It's React, but in Python by nawgz on Tuesday June 06, 2023 @01:28PM (#36216200)
He means API calls, obviously overloaded the term "function calls" a bit

In this case, I think it's also clear that most things you'd call an "application" abhor this behavior, which is why heavy clients are so popular, and small shops without frontend engineering talent are making a big push away from heavy clients which raises all the hubbub about HTMX etc

Re:It's React, but in Python by Izkata on Tuesday June 06, 2023 @02:42PM (#36217255)
No, he meant function calls as opposed to JSX, clarified in another comment.
Re:It's React, but in Python by resoluteteeth on Tuesday June 06, 2023 @02:44PM (#36217279)
> He means API calls, obviously overloaded the term "function calls" a bit

No they literally meant generating html like h1() rather than <h1></h1> in something like jsx templates

(I initially wasn't sure if they were talking about the model of server side rendering with client side events passed back to the server through a websocket either though)

Re:It's React, but in Python by uhtred on Wednesday June 07, 2023 @09:27AM (#36226518)
> He means API calls, obviously overloaded the term "function calls" a bit

lol, no he doesn't

Re:It's React, but in Python by uhtred on Tuesday June 06, 2023 @02:34PM (#36217169)
because ASP .NET webforms suck to work with
Re:It's React, but in Python by shrimpx on Tuesday June 06, 2023 @03:32PM (#36217966)
To be clear, what this comment is talking about is using `p()` and `div()` calls instead of `<p>` and `<div>` tags like in JSX.

On first read, I thought by "generating html from function calls" the author was referring the react-style way of building a UI by writing a reactive function that returns HTML.

Re:It's React, but in Python by Stephen_0xFF on Wednesday June 07, 2023 @02:26AM (#36223546)
Still very much alive. This implementation with python, to me, doesn’t look promising, but Elixirs LiveView does.
Re:It's React, but in Python by innocentoldguy on Wednesday June 07, 2023 @03:22AM (#36223891)
LiveView is awesome. We've completely replaced React with LiveView and the user and developer experience is significantly better.
Re:It's React, but in Python by uhtred on Thursday June 08, 2023 @08:53AM (#36241062)
I feel like I'm talking to kids who have never used anything that came before react in this thread.