Reputation: 161
How to display props or state in alert box ? how to display it on alert box as we print on console.
alert('Props',this.props);
Upvotes: 3
Views: 2144
Reputation: 905
You need to use JSON.stringify to convert it to string.
alert('props: ' + JSON.stringify(this.props));
Upvotes: 1
Reputation: 162
Alert takes only one parameter. If you want to do something like that you should write:
alert('props' + this.props);
Upvotes: 3