import { jsx, jsxs, Fragment } from 'solid-jsx/jsx-runtime';

/*@jsxRuntime automatic @jsxImportSource solid-jsx*/
const toc = [];
function _createMdxContent(props) {
  const _components = Object.assign({
    p: "p",
    a: "a",
    code: "code",
    pre: "pre",
    span: "span"
  }, props.components);
  return jsxs(Fragment, {
    children: [jsx(_components.p, {
      children: "私達にできる props の操作はマージだけではありません。"
    }), "\n", jsx(_components.p, {
      children: "props をグループに分けて、そのうちの一部を現在のコンポーネントで使用し、他のものを子コンポーネントに渡すために分割したい場合がよくあります。"
    }), "\n", jsxs(_components.p, {
      children: ["この目的のために、Solid には ", jsx(_components.a, {
        href: "/docs/latest/api#splitprops",
        children: jsx(_components.code, {
          children: "splitProps"
        })
      }), " があります。これは、props オブジェクトと、独自の props オブジェクトに抽出したいキーの配列を 1 つまたは複数受け取ります。props オブジェクトの配列を返します。指定されたキーの配列ごとに 1 つずつの props オブジェクトと、残余引数と同じように残りのキーを含む 1 つの props オブジェクトが入っています。返されたオブジェクトはすべてリアクティビティを保ちます。"]
    }), "\n", jsxs(_components.p, {
      children: ["今回の例では、", jsx(_components.code, {
        children: "greeting.tsx"
      }), " 内で分割代入したときにリアクティビティが失われたため、name を変更しても更新されません:"]
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: [jsx(_components.span, {
          className: "hljs-keyword",
          children: "export"
        }), " ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "default"
        }), " ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "function"
        }), " ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "Greeting"
        }), "(", jsx(_components.span, {
          className: "hljs-params",
          children: "props"
        }), ") {\n  ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "const"
        }), " { greeting, name, ...others } = props;\n  ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "return"
        }), " ", jsxs(_components.span, {
          className: "xml",
          children: [jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "h3"
            }), " {", jsx(_components.span, {
              className: "hljs-attr",
              children: "...others"
            }), "}>"]
          }), "{greeting} {name}", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "h3"
            }), ">"]
          })]
        }), "\n}\n"]
      })
    }), "\n", jsxs(_components.p, {
      children: ["代わりに、", jsx(_components.code, {
        children: "splitProps"
      }), " でリアクティビティを維持できます:"]
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: [jsx(_components.span, {
          className: "hljs-keyword",
          children: "export"
        }), " ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "default"
        }), " ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "function"
        }), " ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "Greeting"
        }), "(", jsx(_components.span, {
          className: "hljs-params",
          children: "props"
        }), ") {\n  ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "const"
        }), " [local, others] = ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "splitProps"
        }), "(props, [", jsx(_components.span, {
          className: "hljs-string",
          children: "\"greeting\""
        }), ", ", jsx(_components.span, {
          className: "hljs-string",
          children: "\"name\""
        }), "]);\n  ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "return"
        }), " ", jsxs(_components.span, {
          className: "xml",
          children: [jsxs(_components.span, {
            className: "hljs-tag",
            children: ["<", jsx(_components.span, {
              className: "hljs-name",
              children: "h3"
            }), " {", jsx(_components.span, {
              className: "hljs-attr",
              children: "...others"
            }), "}>"]
          }), "{local.greeting} {local.name}", jsxs(_components.span, {
            className: "hljs-tag",
            children: ["</", jsx(_components.span, {
              className: "hljs-name",
              children: "h3"
            }), ">"]
          })]
        }), "\n}\n"]
      })
    }), "\n", jsx(_components.p, {
      children: "これで、ボタンは期待通り動作するようになりました。"
    })]
  });
}
function MDXContent(props = {}) {
  const {wrapper: MDXLayout} = props.components || ({});
  return MDXLayout ? jsx(MDXLayout, Object.assign({}, props, {
    children: jsx(_createMdxContent, props)
  })) : _createMdxContent(props);
}

export { MDXContent as default, toc };
//# sourceMappingURL=lesson-24f9b4d9.js.map
