Answer the question
In order to leave comments, you need to log in
How to communicate with DB in React Universal Apps?
I had my eye on universal (isomorphic) SPAs, but in all boilerplates there are no adequate examples of working with SQL databases, such as Postgre.
Usually they suggest doing this: you do the "frontend" separately, the api separately. What is meant? The fact that on one server there should be this very application, where the server acts as a renderer and a proxy to the api server. And on the other hand, the API server in which the database + microservice.
I think that this is an overkill and we need a way to communicate with the database without unnecessary abstractions, since a public API is not needed.
Answer the question
In order to leave comments, you need to log in
Where is this offered? It seems the other way around, everything is on the same server and the usual approach is this:
Component {
state = Object.assign({}, this.props.initialState);
componentDidMount() {
fetch(...).then(data => this.setState(data));
}
...
}
render on client: Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question