2

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!!

1 Answer 1

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/

Sign up to request clarification or add additional context in comments.

2 Comments

I don't know Spring or Maven. Any other technology/framework?
You don't really need much to learn to just create a webservice to return some data. The first link I gave you will get you on your feet in just 15 minutes if this is your first time. The maven side will be just copy / paste some lines for you. The spring side is super documented. If you still want other frameworks, would be best to know what you know instead of me throwing options. I would still argue Spring or Spring Boot is the most balanced and easy framework to pick up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.