mergeTheme
Overview
Custom merge function for merging theme objects, ensuring classes are combined.
Layers merge left to right, so later arguments win. Pass a lodash-style customizer as the final argument to control how the layers combine, the way lodash mergeWith does. The returned object shares no reference with any argument, so the caller may mutate it freely.
Throws when given fewer than two layers. Nothing merges in that case, so the call is a mistake rather than a degenerate result: it reads as a merge while returning one layer. To merge a variable number of layers, seed the call with an empty object, as buildForm does: mergeTheme({}, ...layers).
Signature
mergeTheme(themes)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| themes | Function | ThemeObject[] | yes | Two or more ThemeObjects to merge, optionally followed by a merge customizer. |
Returns
- The merged ThemeObject.
Throws
- When fewer than two theme layers are supplied.
Source
client/lib/use/themeRegistry.js:99