News for hackers. Stuff that matters.
Re:Things you forgot because of React by antran22 on Tuesday August 15, 2023 @10:42AM (#37134578)
> everything is repeated every six months to two years

Same feeling looking at the new Vercel SQL library. Oh wow now you can write SQL right next to your client-facing code, such convenient. You have just rediscovered PHP.

To be fair, frontend frameworks solve a problem. Application can get too big that you cannot manage all the states imperatively. Declarative UI building really help to keep the UI separated from the logic. But then management get greedy and and try to shove all the features they can think of into one single big app. Like, if you went to a page and click a button, going to another page will let you know that you clicked that button and shows up some nice CTA so you won't forget. Frontend people scramble around trying to create new abstraction to keep their working surface manageable. Then you get workflows where to get the result of an API call you have to dispatch a thunk action so it would update in the global store (my example may be antiquated, I'm away from React & Redux for a little while), instead of just, you know, call it and `.then()` update the UI.

Maybe if you have an app that is twice bigger than a normal app, maybe, I don't know, split it into two apps instead? The problem of web development app right now, I think, is because people are being monolithic where it should be independently modular, and then try to cut up your backend service into pieces when a single monolith works fine.

Re:Things you forgot because of React by robertoandred on Tuesday August 15, 2023 @11:16AM (#37135012)
PHP can't run in the browser.
Re:Things you forgot because of React by sethrin on Tuesday August 15, 2023 @11:53AM (#37135486)
I'd say don't give anyone bad ideas, but we are too late:

https://github.com/oraoto/pib

Re:Things you forgot because of React by antran22 on Tuesday August 15, 2023 @12:04PM (#37135622)
Sorry friend, WordPress already beat you to it: https://github.com/WordPress/wordpress-playground
Re:Things you forgot because of React by antran22 on Tuesday August 15, 2023 @12:01PM (#37135585)
Ah but that's not what I am referring to. If you take a look at Vercel Postgres page [^0], you will see that Vercel is marketing a new way of writing server side rendered code, where you can write SQL code right next to the HTML-ish code for the frontend. So I'm just merely making a (meant to be humorous) comparison with PHP.

> PHP can't run in the browser.

Well actually, WordPress did it [^1] [^2]. They compiled PHP to WASM, so you can run our favorite web framework in your own browser.

I see your point anyway. Systems evolve. Tooling has to follow suit. PHP cannot achieve some of the feat today mega stack can. The problem arises when we apply the latest bleeding edge technology meant for systems that have to serve millions into our little MVP that may have less than 1000 users in your first few years.

[0]: https://vercel.com/storage/postgres [1]: https://developer.wordpress.org/playground/ [2]: https://github.com/WordPress/wordpress-playground

Re:Things you forgot because of React by robertoandred on Tuesday August 15, 2023 @12:21PM (#37135844)
You don't need a mega stack to attach an event listener to an element. PHP can't do that.
Re:Things you forgot because of React by omnimus on Tuesday August 15, 2023 @02:52PM (#37137761)
I dont think you are listening what he is saying. The vercel sql library is serverside javascript. This could be any language. What the library reinvets is pattern that has been criticised, hated and laughed at not that long ago. Especially in this form of raw sql mixed in between html.

It was specifically the react/you-must-have-api crowd who bashed PHP bacause of this.

I guess in the end PHP was what people wanted all along.

Re:Things you forgot because of React by robertoandred on Tuesday August 15, 2023 @03:46PM (#37138436)
The Vercel SQL library doesn't mix raw SQL and HTML. It can't, since that'd easily allow public db access on the frontend.

What people wanted was the speed of a server-rendered starting point and the flexibility and performance of client-side templating and interactivity. JS/React can deliver this, PHP cannot.

Re:Things you forgot because of React by tacker2000 on Tuesday August 15, 2023 @06:28PM (#37140105)
You could do that with PHP backend + any frontend framework during the last 2 decades before.

OK, now you can do it using just one JS framework i guess? But is it a revolution? A breakthrough?

Re:Things you forgot because of React by robertoandred on Tuesday August 15, 2023 @11:43PM (#37142619)
You couldn't do that before. Combining a PHP backend and a frontend framework meant you had two different html templates.
Re:Things you forgot because of React by omnimus on Wednesday August 16, 2023 @04:56AM (#37144426)
What are you event talking about? Are you aware that any touring completel language can output JSON... what two different html templates?
Re:Things you forgot because of React by tacker2000 on Wednesday August 16, 2023 @05:47AM (#37144766)
Thats not true. You had one .php file (or more, if you use includes) where everything was located: the HTML, if necessary any JS via <script> and interspersed with <?php … ?> depending on what dynamic stuff you wanted to output.

And this is parsed to one output file that is sent back to the browser.

Re:Things you forgot because of React by omnimus on Wednesday August 16, 2023 @04:54AM (#37144414)
Wow i just said that it is server side javascript because you were claiming ... and that its mixing raw sql with html template like what was hated in PHP. Have you even looked at https://vercel.com/storage/postgres - its right there in their example.

You are either trolling me or you are not really sure how these things work?