mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
17 lines
1.7 KiB
JSON
17 lines
1.7 KiB
JSON
{
|
|
"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"
|
|
} |