This commit is contained in:
Tomas Dvorak
2026-02-24 10:33:59 +01:00
parent 409acd2e08
commit 898a3c303f
1374 changed files with 290409 additions and 29187 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"id": "27b93a03433fe3a2e7698ffe",
"source": "solid:signals",
"type": "github-document",
"title": "merge-props",
"content": "---\ntitle: mergeProps\nuse_cases: \u003e-\n component props, default values, prop cloning, prop merging, component\n configuration\ntags:\n - props\n - components\n - reactivity\n - defaults\n - cloning\n - merging\nversion: '1.0'\ndescription: \u003e-\n Learn how to merge reactive props in SolidJS for setting component defaults,\n cloning props objects, and combining multiple prop sources dynamically.\n---\n\n```ts\nimport { mergeProps } from \"solid-js\"\n\nfunction mergeProps(...sources: any): any\n\n```\n\nA reactive object **merge** method.\nUseful for setting default props for components in case caller doesn't provide them.\nOr cloning the props object including reactive properties.\n\nThis method works by using a proxy and resolving properties in reverse order.\nThis allows for dynamic tracking of properties that aren't present when the prop object is first merged.\n\n```ts\n// default props\nprops = mergeProps({ name: \"Smith\" }, props)\n\n// clone props\nnewProps = mergeProps(props)\n\n// merge props\nprops = mergeProps(props, otherProps)\n```",
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/reactive-utilities/merge-props.mdx",
"metadata": {
"path": "src/routes/reference/reactive-utilities/merge-props.mdx",
"repo": "solidjs/solid-docs",
"repo_url": "https://github.com/solidjs/solid-docs.git",
"size": 1029,
"source_type": "github"
},
"hash": "a908a1c0e9e8b2c4197a287d73113f90c8bc113dfb7f7dfd249ad856285566ea",
"timestamp": "2026-02-23T11:43:00.190002979+01:00"
}