sau123 sau123 - 5 months ago 10
Javascript Question

using this.props.someVariable

I am using this.props.someVariable to pass on a variable from one component to another. I would like to debug the variable using console.log().

I am not able to use it in console.log(this.props.someVariable) but it works fine within a tag.

var secondComp = React.createClass({
render(){
console.log({this.props.myProp}); // doesn't work
return(
<Text>{this.props.myProp}</Text>
);
}
});

Answer

Just do:

console.log(this.props.myProp);