R
R
r1mple2020-07-27 21:53:33
Express.js
r1mple, 2020-07-27 21:53:33

How to pass data from ExpressJS to ReactJS?

There is an app with back end on express and front end on react. Conventionally, the essence of the application is to receive weather data for the current day. The application will be without a database. And so, how to pass a variable or any other information in general from express to react, so that later this information could be displayed in a regular html tag?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
hzzzzl, 2020-07-27
@hzzzzl

https://expressjs.com/ru/guide/routing.html

M
McBernar, 2020-07-27
@McBernar

Make a route for api. In this route, pass the necessary information. From React, access this route via axios/xhr/fetch, get the data, display it on the screen.

I
Islam Ibakaev, 2020-07-28
@devellopah

I did such a thing a couple of years ago, however, I used vuejs for the front (but it doesn’t matter).
Here is the proxy server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question