LoginSignup
2
0

More than 5 years have passed since last update.

【VueとReact:初心者】 Vueの{{ $data }}みたいに ReactでもState表示 JSON.stringfy()

Last updated at Posted at 2018-12-24

【*初心者のただのメモです。】

Vue初日
Vueの{{ $data }}が便利で
Reactでも表示できないか調べた 。

オブジェクト一覧表示 JSON.stringfy()
React State 一覧

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
    }
}

preタグが機能しないから調べたら
引数でスペース指定できるみたい!!

こんな感じででる!! 詳しくはURL!!
ただそれだけ。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0