{"id":3507,"date":"2022-08-29T05:04:18","date_gmt":"2022-08-28T20:04:18","guid":{"rendered":"https:\/\/blog.wsd.sh\/?p=3507"},"modified":"2022-08-31T21:20:10","modified_gmt":"2022-08-31T12:20:10","slug":"3507","status":"publish","type":"post","link":"https:\/\/blog.wsd.sh\/?p=3507","title":{"rendered":"<small>React:\u95a2\u6570\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u30af\u30e9\u30b9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/small>"},"content":{"rendered":"<p>1. url<br \/>\n<a href=\"https:\/\/ja.reactjs.org\/docs\/components-and-props.html\">https:\/\/ja.reactjs.org\/docs\/components-and-props.html<\/a><\/p>\n<p>2. \u89e3\u8aac\u306e\u5206\u89e3<br \/>\ncomponent\u3092\u5b9a\u7fa9\u3059\u308b\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u306a\u65b9\u6cd5\u306f JavaScript \u306efunction\u3092\u66f8\u304f\u3053\u3068\u3067\u3059\uff1a<\/p>\n<pre>\r\nfunction Welcome(props) {\r\n  return &lt;h1>Hello, {props.name}<\/h1>;\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u306fJavaScript \u306efunction\u3067\u3059\u3002<br \/>\n\u3053\u306efunction\u306f\u3001React \u306e\u6709\u52b9\u306a\u8981\u7d20\u3092\u8fd4\u3059\u3001React\u306e component\u3067\u3059\u3002<br \/>\n\u3053\u306efunction\u306f\u3001\u30c7\u30fc\u30bf\u306e\u5165\u3063\u305f \u201cprops\u201d\u3092\u5f15\u6570\u3068\u3057\u3066\u4e00\u3064\u53d7\u3051\u53d6\u308b\u3002<br \/>\n\u201cprops\u201d\u306f\u3001Property\u306e\u7279\u6027\u3092\u3082\u3061\u3001props\u304c\u5024\u3092\u4fdd\u6301\u3059\u308b\u3002<br \/>\n\u3064\u307e\u308aProperty\u306e\u7279\u6027\u3067\u3042\u308b\u300cprops\u304c\u5024\u3092\u4fdd\u6301\u3059\u308b\u300d\u3068\u3044\u3046\u306e\u306f\u3001\u300cprops\u304c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53c2\u7167\u3092\u4fdd\u6301\u3057\u3066\u3044\u308b\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<br \/>\n\u3053\u306e\u305f\u3081\u3001props\u306e\u5024\u3092\u5909\u66f4\u3057\u3066\u3082\u3001\u5143\u306e\u53c2\u7167\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5024\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u3053\u306e\u3088\u3046\u306acomponent\u306e\u3053\u3068\u3092 \u201cfunction component (\u95a2\u6570\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8)\u201d \u3068\u547c\u3076\u3002<\/p>\n<p>3.\u30e6\u30fc\u30b6\u5b9a\u7fa9\u306ecomponent\u306e\u540d\u524d\u306f\u5927\u6587\u5b57\u3067\u59cb\u3081\u308b<br \/>\nReact \u306f\u5c0f\u6587\u5b57\u3067\u59cb\u307e\u308bcomponent\u3092 DOM \u30bf\u30b0\u3068\u3057\u3066\u6271\u3046\u3002<br \/>\n\u4f8b\u3048\u3070\u3001&lt;div \/> \u306f HTML \u306e div \u30bf\u30b0\u3092\u8868\u308f\u3059\u3002<br \/>\n\u4e00\u65b9\u3001&lt;Welcome \/> \u306fcomponent\u3092\u8868\u3057\u3001\u30b9\u30b3\u30fc\u30d7\u5185\u306b Welcome \u304c\u5b58\u5728\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>React\u306f\u3001\u3042\u308b\u8981\u7d20\u306e\u578b\u304c\u5c0f\u6587\u5b57\u304b\u3089\u59cb\u307e\u3063\u3066\u3044\u308b\u3088\u3046\u306a\u5834\u5408\u3001\u305d\u308c\u306f &lt;div> \u3084 &lt;span> \u306e\u3088\u3046\u306a\u7d44\u307f\u8fbc\u307f\u306ecomponent\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u3089\u306f\u305d\u308c\u305e\u308c &#8216;div&#8217; \u3084 &#8216;span&#8217; \u3068\u3044\u3063\u305f\u6587\u5b57\u5217\u306b\u5909\u63db\u3055\u308c\u3066 React.createElement \u306b\u6e21\u3055\u308c\u308b\u3002<br \/>\n\u4e00\u65b9\u3067 &lt;Foo \/> \u306e\u3088\u3046\u306b\u5927\u6587\u5b57\u3067\u59cb\u307e\u308b\u578b\u306f React.createElement(Foo) \u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u308b\u3002<br \/>\n\u52a0\u3048\u3066\u3001JavaScript \u30d5\u30a1\u30a4\u30eb\u306b\u304a\u3044\u3066\u5b9a\u7fa9\u3042\u308b\u3044\u306f\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u305fcomponent\u3092\u53c2\u7167\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. url https:\/\/ja.reactjs.org\/docs\/components-and-props.html 2. \u89e3\u8aac\u306e\u5206\u89e3 component\u3092\u5b9a\u7fa9\u3059\u308b\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u306a\u65b9\u6cd5\u306f JavaScript \u306efun&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3507"}],"collection":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3507"}],"version-history":[{"count":27,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3507\/revisions"}],"predecessor-version":[{"id":3509,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/3507\/revisions\/3509"}],"wp:attachment":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}