【Vue and React: Beginner】 Like Vue's {{ $data }}, React also displays State in JSON.stringfy()
2
[* Just a note for beginners. 】
Vue First Day Vue {{ $data }} is useful I checked to see if it could be displayed in React as well.
Object list display JSON.stringfy() React State List
Vue https://jsfiddle.net/HarapekoWolf/ehmnt9bc/
React https://codesandbox.io/s/3y7zz71rv5
sample.js
render() {
const outputTest = JSON.stringify(this.state, undefined, 4);
return (
<div>
<pre>{outputTest}</pre>
</div>
);
}
{
"title": "Hello, React!",
"user": {
"name": "tom",
"age": 16
}
}
If you check because the pre tag does not work It seems that you can specify a space with arguments!!
It comes out like this!! For details, please URL!! That's it.