I have a reactjs app that needs to get data. There is a java class that connects to the database and gets data. Can I call this java class from my react app? I'm a complete newbie with react. Reading and working on my first app.
Thanks!!
答案 0 :(得分:4)
Java would be your backend. You need to make a webservice (for instance, a rest service).
Then you would call that service from your React app (your front end).
You can make a rest webservice with pretty much any technology / framework. Something like Spring will get you up and running in 5 minutes: https://spring.io/guides/gs/rest-service/
Complete tutorial using Spring + React: https://spring.io/guides/tutorials/react-and-spring-data-rest/