I'm debugging a <View>
element and want to ensure a variable is being returned correctly. How would I console.log(element)
so I can view it in the console and ensure it's correct?
Yes, it is possible.
return(
<View>
{console.log(element)}
</View>
)
There might be a number of tricks to do this, but I would advise storing what you want to return in a variable, and then log the value you are interested before the return, like this:
render() {
let element = <MyElement></MyElement>
console.log(element)
let wrappingView = <View>{element}</View>
return wrappingView;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With