B
B
bpGusar2018-04-28 17:08:53
Backend
bpGusar, 2018-04-28 17:08:53

Explain in simple terms how React communicates with a backend like Java or PHP?

For example, I understand how in ordinary life the communication between the front and the back happens when developing a site on, for example, html/css/jquery/js everything is simple there, but I want to develop further and try React and I don’t understand how the react communicates with the back. I understood how react works, I tried to work with firebase, is it really the same with Java or PHP? Through the API, I pull the data from the back and output the parsed JSON to the client? Or how?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Stolyarov, 2018-04-28
@Ni55aN

REST API. Most often in JSON format.
The difference from the oldschool practice is that the server and client application are separated.
The second is responsible for the visual part and user interaction. The first is responsible for the data and business logic. Although it may be different.
The main thing is that in the REST API, the non-back-end server should not respond to html generation, etc.

P
Pantene742, 2018-04-28
@Pantene742

Using the http protocol which runs over TCP/IP. It's called REST. Read theory books. You are probably one of those who say that why universities and theory. Sit down and program. But what I can advise is Tanembaum's books. Computer architecture. OS architecture. Third book Computer networks. I would also recommend books about Algorithms, Code The Secret Language of Informatics. Then you won't ask such stupid questions.
There are about 4,000 pages of the listed books. Read at least 1,000. selectively. Also google wikipedia. This will give you an idea of ​​what programming is all about. Front End This is application programming. Here you definitely need to be identified in Computer Science

N
nlog, 2018-04-28
@nlog

If under

react-to-backlink communication
implies sending HTTP requests using AJAX, then you can use any convenient technology: window.fetch, jQuery.ajax(), superagent, axios, etc.
In simple cases, data loading is done in a componentDidMountcomponent method.

B
bacca, 2018-05-04
@bacca

On the server, you follow requests a la api/users and give data to Json. parse them in js as you need.
Also on the server. you always return the same view, and react itself figure out what to show to the client using internal routing.
In the same place, he makes requests to "api" where and how he will turn, what data he needs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question