Skip to content
Advertisement

Where am I going wrong with returning an array from a react function [closed]

So I have a react function that is a api call ad gets some data, I want to just return the status of that back to the parent component.

Here is my code

Parent component function

JavaScript

Child function

JavaScript

I am getting undefined when console.log(returned) is called.

Advertisement

Answer

You are returning from the callback function and not from the SchedulePayment . You should add return before your api call in order to work. Or in a nicer way

JavaScript
Advertisement