Answer the question
In order to leave comments, you need to log in
How to connect react with backend?
Tell me where you can find a detailed tutorial, or at least in what order and what to read in order to understand how to implement authorization through passport js on react and node.
Everything is clear with the backing, but how to attach the react there is not very
Answer the question
In order to leave comments, you need to log in
how to communicate with api with react
fetch
and with the help of React's lifecycle methods.class Test extends Component{
constructor(){
super()
this.state = {
someData: []
}
}
componentDidMount(){
.fetch(//Ваша урла)
.then(data => {
return data.json
}).then(data=>{
//Делаете что-то например перербор и JSX)
//Обновляете стейт если надо
}
}
render(){}
}
exactly the same as usual - you have an api, spa communicates with the server through it, which is secondary on the server for the frontend
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question