I'm new to React JS, but I want to connect my backend with React JS. I want to get the input field data and connect it with Backend. I previously used EJS for FE. I want to do same like on React. Is it possible?
-
You should able to find some guide over the internet, there are relatively plenty of articles and videos to do it, once something doesn't work on the guide or something is hard to understand you can ask again here – Orville Aug 13 '20 at 04:21
-
@Sreerag to get help quickly try to configure your work on React fiddle i.e. jsfiddle , codeopen, codebox – Mohtisham Zubair Aug 13 '20 at 04:51
2 Answers
You could try starting by forking a ready-to-use example sandbox on codesandbox.
There's a tutorial on how to set things yourself up in the README.md
file. I would highly suggest setting it up atleast once locally, so as to get an idea you would need to get it up and running yourself.

- 1,297
- 6
- 9
ReactJS is front end and NodeJS is backend,
You cannot directly communicate with backend, but you can create a REST API which allows your frontend to communicate with your backend.
Create your API on nodejs backend then from your frontend send the data via post request on the endpoint of your API.
The way react client-side work it's not like PHP, you are navigating to different pages that are already loaded in via javascript files, everything is rendered via Javascript so it does not render from the server that is why an API will be required to communicate/fetch data.
there are options to render reactjs on the server-side, such as NEXTJS is the best framework to render Reactjs on the server, but still, most of the part of reactjs will be on client js.

- 1,036
- 1
- 13
- 23