I'm having a MERN stack app, so at first I thought that I'll host my whole app in my vps, and then when a user tries to access the website,my vps will execute the back-end (nodejs)and then it will send the fornt-end (react.js) to the client browser, and then the browser will render it. but just now I watched a tutorial (ben Awad's), and he said that you can host the backend in vps, and host the front-end (react.js) in another server like netlify. so which one is correct? and if the second, tell me more
To be clear, a React application doesn't serve itself. It's all in-browser. You would need to have some sort of server-side piece to serve it up. That being said, there are all sorts of different places you could put it. A CDN if you need one, S3 if you use aws, or you could simply serve it up as static assets from your backend application. As far as what's right, it's dependent. If you need server side rendering, for example, you'll have to serve it up yourself. If not, you can serve it however makes the most sense for your app.