i’m expecting this to be something very simple that I am too tired and overlooked, but hoping someone can help!
I have a function that my parent component inherits from the provider. I am attempting to pass the function to the child with the below:
console.log(typeof(runServerless))
<VaultEntry contactInfo={userData} runServerless={runServerless}/>
That console log shows a array and if I directly log the function, it shows the function. Now, immediately upon VaultEntry:
export const VaultEntry = (contactInfo, runServerless) => {
console.log(runServerless)
}
that console.log returns a blank object and I can’t call it.
Soooo hoping someone knows what thing I am missing. Appreciate all the help! Thank yoU!
2
Answers
function components take props as first argument
If you want the props values directly without
props.runServerless
you need to deconstruct the props argument on declaration inlineYou just have to descructure it like:
so add
{}
in props and it should work fine