From the course: Spring Boot and React: Build Scalable and Dynamic Web Apps

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Loading live data

Loading live data

- [Instructor] And now it's time to actually get to the real reason you came here and that is to see how to wire the front end to the back end and then we can go and package this thing. So let's jump back into our component and pick up there. Go ahead and open up that customer's component. And we're going to go up to the top of our function here. And we are going to start by using some states. So we will do customers, set customers equal to use state and we will start with an empty array. I don't want to use null here because I want it to be able to load before the async call occurs that we're going to go build next. So go ahead and do it with an empty array. Now we will create a used layout effect and you can go read all about react states and which one you should use when. For the purpose of this, this works just fine. So within this anonymous function, we are going to set a const of get customers equals async.…

Contents