News for hackers. Stuff that matters.
Re:Moving from Go to PHP Again by gnarcoregrizz on Friday February 08, 2019 @02:53AM (#19112299)
"and embedding php in the html made for a rapid though sometimes trying experience."

Funny, that is React/JSX's biggest sell

Re:Moving from Go to PHP Again by likeclockwork on Friday February 08, 2019 @03:40AM (#19112466)
JSX adding HTML literals to JS is fundamentally different than embedding PHP in HTML.
Re:Moving from Go to PHP Again by ggregoire on Friday February 08, 2019 @03:24AM (#19112415)
Not really comparable tho. In React, the JS in the HTML is to make loops and conditional rendering, i.e. presentational logic, like in any other templating system. In PHP, you can embed business logic and database accesses in the HTML.
Re:Moving from Go to PHP Again by Aeolun on Friday February 08, 2019 @06:35AM (#19113288)
You can do the same in your React render method I suppose, though it’s a bit harder since you are not attached to the server.
Re:Moving from Go to PHP Again by nprateem on Friday February 08, 2019 @03:19AM (#19112390)
React can't execute arbitrary database queries.
Re:Moving from Go to PHP Again by Aeolun on Friday February 08, 2019 @06:36AM (#19113295)
I’m sure you can use the all JS mysql client to connect directly from your client app to your database.
Re:Moving from Go to PHP Again by nprateem on Friday February 08, 2019 @10:50AM (#19115286)
Well yes if you're stupid enough to directly expose your DB to the world then it's technically possible, but barring such idiocy there's arguably more risk of a DB hack through PHP than client side JS in most architectures.
Re:Moving from Go to PHP Again by mixedCase on Friday February 08, 2019 @12:14PM (#19116366)
React can do SSR. You can use JSX on the backend for rendering pages just like on PHP.
Re:Moving from Go to PHP Again by gdfasfklshg4 on Friday February 08, 2019 @06:17AM (#19113198)
Can too!

{e = () => ajaxCallToMutateDatabase()}

Or something similar...

It's just people don't do it because it is a bad idea!