mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
ac5a06027e
This reverts commit ea8ed28209
.
19 lines
440 B
TypeScript
19 lines
440 B
TypeScript
import * as React from 'react';
|
|
|
|
export default function useMergedConfig<Target>(
|
|
propConfig: any,
|
|
templateConfig?: Target,
|
|
): readonly [boolean, Target] {
|
|
return React.useMemo<readonly [boolean, Target]>(() => {
|
|
const support = !!propConfig;
|
|
|
|
return [
|
|
support,
|
|
{
|
|
...templateConfig,
|
|
...(support && typeof propConfig === 'object' ? propConfig : null),
|
|
},
|
|
] as const;
|
|
}, [propConfig]);
|
|
}
|