Defined function is undefined when called React-Native [on hold]

The name of the picture


Defined function is undefined when called React-Native [on hold]



I'm currently working on an application in React-Native implementing Redux and Thunk and I stumbled across an error I can't figure out:



My view container ( The one that connect the component view with a mapStateTopProps and a mapDispatchToProps ) set a method named 'getAllEvents()' in my component props. Even if the method is defined as shown on the screenshot below, I get an undefined whenever I call it...



error


this.props.getAllEvents => [Function getAllEvents]
this.props.getAllEvents() => undefined



How can a defined function could return undefined when it is called?



This question appears to be off-topic. The users who voted to close gave this specific reason:





stackoverflow.com/help/how-to-ask
– Zyigh
22 mins ago





thanks, I've edited the question
– Agterra
17 mins ago




1 Answer
1



It is perfectly valid for a JavaScript function to return undefined. For example these two functions below are defined and they will return undefined when called:


undefined


undefined




function empty() {
}

function retUndefined() {
return undefined;
}

console.log(empty());
console.log(retUndefined());

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

Future solutions