<\/span><\/h2>\n\n\n\n\u30d5\u30ea\u30fc\u30e9\u30f3\u30b9\u306b\u306a\u3063\u3066\u304b\u3089\u65e92\u5e74\u3002\u524d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u89e3\u6563\u3068\u306a\u308a\u3001\u65b0\u3057\u304fReact JS\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u53c2\u753b\u3057\u307e\u3057\u305f\u3002React\u306b\u95a2\u3057\u3066\u306f\u307b\u307c\u521d\u3081\u3066\u3067\u3057\u305f\u304c\u3001\u6700\u8fd1\u6163\u308c\u3066\u304d\u305f\u306e\u3067\u3001\u307c\u3061\u307c\u3061React\u306b\u95a2\u3059\u308b\u8a18\u4e8b\u3082\u66f8\u3044\u3066\u3044\u3053\u3046\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n
React.memo<\/code> \u3092\u4f7f\u3063\u305f\u3068\u304d\u306b\u3046\u307e\u304f\u50cd\u3044\u3066\u3044\u306a\u3055\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u8abf\u3079\u305f\u3053\u3068\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<\/span>React.memo \u3068\u306f\uff1f<\/span><\/h2>\n\n\n\n\u901a\u5e38\u3001React\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u89aa\u304c\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u308b\u3068\u3001\u5b50\u3082\u540c\u3058\u304f\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0<\/strong>\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u524d\u5f8c\u3067\u3001\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u540c\u3058\u30d7\u30ed\u30d1\u30c6\u30a3\uff08props\uff09\u304c\u6e21\u3055\u308c\u308b\u3068\u304d\u3001\u5f53\u7136\u3001\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u540c\u3058\u3082\u306e\u306b\u306a\u308b\u305f\u3081\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3059\u308b\u306e\u306f\u305f\u3060\u306e\u7121\u99c4\u3067\u3059\u3002<\/p>\n\n\n\n
React.memo<\/code>\u3092\u7528\u3044\u308b\u3068\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u524d\u3068\u540c\u3058\u30d7\u30ed\u30d1\u30c6\u30a3\uff08props\uff09<\/strong>\u3092\u53d7\u3051\u53d6\u3063\u305f\u3068\u304d\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u30b9\u30ad\u30c3\u30d7\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n\u305d\u306e\u7d50\u679c\u3001\u305f\u304f\u3055\u3093\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3063\u305f\u308a\u3001\u983b\u7e41\u306b\u753b\u9762\u304c\u66f4\u65b0\u3055\u308c\u308b\u5834\u5408\u306b\u3001\u753b\u9762\u63cf\u753b\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u826f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n
<\/span>\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/span><\/h2>\n\n\n\nReact.memo<\/code>\u306e\u4f7f\u3044\u65b9\u306f\u3044\u305f\u3063\u3066\u30b7\u30f3\u30d7\u30eb\u3067\u3001\u95a2\u6570\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30e9\u30c3\u30d7\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u3057\u3066\u304a\u3051\u3070\u3001\u89aa\u304c\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u3066\u3082\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u6e21\u3055\u308c\u308bprops.value<\/code>\u304c\u5909\u308f\u3089\u306a\u3044\u9650\u308a\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\nimport React from 'react';\n\nconst MyComponent = React.memo((props) => {\n return (<div>{props.value}<\/div>);\n});\n\nexport default MyComponent;<\/code><\/pre><\/div>\n\n\n\n<\/span>\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u4f8b<\/span><\/h2>\n\n\n\n\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f\u3001\u89aa\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u300cIncrement Parent\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u89aa\u306f\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u3059\u304c\u3001React.memo<\/code>\u3067\u30e9\u30c3\u30d7\u3055\u308c\u305fChildComponent<\/code>\u306f\u3001childCount<\/code>\u304c\u5909\u308f\u3089\u306a\u3044\u9650\u308a\u3001\u8868\u793a\u304c\u5909\u308f\u308b\u3053\u3068\u304c\u306a\u3044\u305f\u3081\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\nimport React, { useState } from 'react';\nconst ChildComponent = React.memo(({ count }) => {\n return (<div>Child Count: {count}<\/div>);\n});\n\nconst ParentComponent = () => {\n const [parentCount, setParentCount] = useState(0);\n const [childCount, setChildCount] = useState(0);\n return ( \n <div>\n <div>Parent Count: {parentCount}<\/div>\n <button onClick={() => setParentCount(parentCount + 1)}>\n Increment Parent\n <\/button>\n <ChildComponent count={childCount} \/>\n <button onClick={() => setChildCount(childCount + 1)}>\n Increment Child\n <\/button>\n <\/div>\n );\n};\nexport default ParentComponent;<\/code><\/pre><\/div>\n\n\n\n\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u89aa\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u300cIncrement Parent\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u3082\u3001ChildComponent<\/code>\u306f\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u305b\u3093\u3002\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u30ab\u30a6\u30f3\u30c8\u304c\u5909\u308f\u3089\u306a\u3044\u9650\u308a\u3001\u8868\u793a\u304c\u5909\u308f\u3089\u306a\u3044\u305f\u3081\u3067\u3059\u3002<\/p>\n\n\n\n<\/span>\u6ce8\u610f\u70b9<\/span><\/h2>\n\n\n\n\u3053\u308c\u3060\u3051\u805e\u304f\u3068\u3001\u5168\u90e8React.memo<\/code>\u3067\u30e9\u30c3\u30d7\u3059\u308c\u3070\u3044\u3044\u3058\u3083\u306a\u3044\u304b\uff01\u3068\u601d\u3044\u304c\u3061\u3067\u3059\u304c\u3001\u3044\u304f\u3064\u304b\u6ce8\u610f\u3059\u308b\u3079\u304d\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<\/span>1. props\u306e\u6bd4\u8f03\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3053\u3068\u304c\u3042\u308b<\/span><\/h3>\n\n\n\n\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u914d\u5217\u304c\u6e21\u3055\u308c\u305f\u5834\u5408<\/strong>\u3001\u4e2d\u8eab\u304c\u540c\u3058\u3067\u3042\u3063\u3066\u3082\u3001\u65b0\u3057\u3044\u3082\u306e\u3068\u8a8d\u8b58\u3055\u308c\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\nReact.memo<\/code>\u3067\u306f\u3001\u7b2c\u4e8c\u5f15\u6570<\/strong>\u306b\u6bd4\u8f03\u95a2\u6570\u3092\u4e0e\u3048\u308b\u3053\u3068\u3067\u3001\u6b63\u3057\u304f\u5224\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\nconst MyComponent = React.memo(\n (props) => {\n return <div>{props.values.join(',')}<\/div>;\n },\n (prevProps, nextProps) => {\n return prevProps.values.join(',') === nextProps.values.join(',');\n }\n);<\/code><\/pre><\/div>\n\n\n\n\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u5834\u5408\u3001values<\/code>\u304c\u914d\u5217\u3067\u3059\u304c\u3001\u4e00\u5ea6\u3001\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u3066\u4e2d\u8eab\u3092\u6bd4\u8f03\u3059\u308b\u3053\u3068\u3067\u3001\u914d\u5217\u306e\u4e2d\u8eab\u304c\u5909\u308f\u3089\u306a\u3044\u9650\u308a\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u9632\u3044\u3067\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<\/span>2. \u3059\u3079\u3066\u306e\u30b1\u30fc\u30b9\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u5411\u4e0a\u3059\u308b\u308f\u3051\u3067\u306f\u306a\u3044<\/span><\/h3>\n\n\n\n\u5f53\u7136\u3067\u3059\u304c\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3059\u308b\u3053\u3068\u304c\u306a\u3044\u306e\u306b\u3001React.memo<\/code>\u3092\u4f7f\u3063\u3066\u3057\u307e\u3046\u3068\u9006\u306b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4e0b\u304c\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n\n\n\n\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u8d85\u30b7\u30f3\u30d7\u30eb\u3060\u3063\u305f\u308a\u3001\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3059\u308b\u3053\u3068\u304c\u5c11\u306a\u3044\u5834\u5408\u306f\u3001\u9006\u306b\u30e1\u30e2\u5316\u306e\u51e6\u7406\u304c\u8ca0\u62c5\u306b\u306a\u308b\u3053\u3068\u3082\u3042\u308b\u306e\u3067\u3001\u672c\u5f53\u306b\u5fc5\u8981\u304b\u8003\u3048\u3066\u304b\u3089\u4f7f\u3063\u305f\u307b\u3046\u304c\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n
\uff08\u305f\u3060\u3001memo\u5316\u306e\u51e6\u7406\u304c\u3081\u3061\u3083\u3081\u3061\u3083\u8ca0\u8377\u306b\u306a\u308b\u3053\u3068\u306f\u5c11\u306a\u3044\u306e\u3067\u3001\u3081\u3063\u3061\u3083\u5927\u304d\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3058\u3083\u306a\u3044\u9650\u308a\u3001\u5168\u90e8memo\u5316\u3057\u3066\u3082\u3044\u3044\u3093\u3058\u3083\u306d\uff1f\u3068\u304b\u601d\u3063\u3066\u307e\u3059\uff09<\/p>\n\n\n\n
<\/span>\u307e\u3068\u3081<\/span><\/h2>\n\n\n\nmemo<\/code>\u306f\u3001\u4e0d\u8981\u306a\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u9632\u3052\u3066\u4fbf\u5229\u3067\u3059\u304c\u3001\u6ce8\u610f\u3057\u306a\u3044\u3068\u3046\u307e\u304f\u52d5\u304b\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u914d\u5217\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3001\u3046\u307e\u304f\u5224\u5b9a\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30ab\u30b9\u30bf\u30e0\u306e\u6bd4\u8f03\u95a2\u6570\u3092\u4f7f\u3046\u3068\u3001\u67d4\u8edf\u306b\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n
props\u306b\u914d\u5217\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u304c\u3042\u308b\u5834\u5408\u3001\u7591\u3063\u3066\u307f\u3066\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"React.memo \u306f\u540c\u3058props\u3067\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u9632\u304e\u307e\u3059\u304c\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u914d\u5217\u306e\u5834\u5408\u3001\u65b0\u3057\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u3060\u3068\u8a8d\u8b58\u3055\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3046\u307e\u304f\u6bd4\u8f03\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u9632\u3050\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":208600,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[41],"tags":[43,180,179],"class_list":["post-208579","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-memo","tag-react"],"aioseo_notices":[],"jetpack_featured_media_url":"http:\/\/cms.inter-arteq.com\/wp-content\/uploads\/2024\/10\/react-memo.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/208579"}],"collection":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/comments?post=208579"}],"version-history":[{"count":8,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/208579\/revisions"}],"predecessor-version":[{"id":208607,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/208579\/revisions\/208607"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media\/208600"}],"wp:attachment":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media?parent=208579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/categories?post=208579"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/tags?post=208579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}