Skip Navigation

What is the major difference in React (web app) and PHP being not a web app - or how do I decide what to use

What is the major difference in React (web app) and PHP being not a web app - or how do I decide what to use

#ELI5

6

You're viewing a single thread.

6 comments
  • React is a JavaScript framework. It is mainly used to make complex UIs for websites and apps with React Native. PHP is a server-side language that can communicate with databases, external API’s, other servers, etc. You could technically accomplish these same tasks with a front end framework as well, but generally a server-side application is used in practice as you would need to expose things like API keys, database connection strings, and so on that you wouldn’t want to pass to a client-side application, since they are inherently untrustworthy.

    In a lot of my applications I use the SPA approach which has two (technically three) layers. I use Vue (another framework like React) for the frontend application, and C# (a server-side language that can do many of the same things as PHP) for the backend with SQL Server as the database.

    Where it gets confusing is that you can actually just cut out the frontend framework entirely depending on the complexity of your application. PHP (And C#, and a bunch of other languages) can generate static assets like HTML and send them directly to the browser “pre-baked” This is known as server-side rendering. Essentially you fetch whatever data is needed for display on the page and then generate the page view on the backend, then send that entire view to the browser. With a single-page application using a framework like React, you would request the necessary data from the client-side app, and your backend code would process the business logic and send the data to display. The framework would then handle re-rendering the page with the updated data.

You've viewed 6 comments.