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