mergeProps & splitProps in SolidJS
From the SolidJS cheat sheet ยท Props Utilities ยท verified Jul 2026
mergeProps & splitProps
Set default props with mergeProps and separate local from pass-through props with splitProps.
tsx
// Quick Reference
import { mergeProps, splitProps } from "solid-js";
// Default props
const merged = mergeProps({ color: "blue" }, props);
// Split props into groups
const [local, others] = splitProps(props, ["class", "style"]);๐ก Never destructure props โ it reads the value once and loses reactivity
โก splitProps returns [picked, rest] โ perfect for passing remaining props to DOM elements
๐ mergeProps creates a new reactive object with defaults that can be overridden
๐ข These utilities exist because destructuring breaks the reactive proxy
propsmergePropssplitProps