File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
src/components/config-provider Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -81,14 +81,17 @@ export const ConfigProvider: FC<ConfigProviderProps> = props => {
8181 const { children, ...config } = props
8282 const parentConfig = useConfig ( )
8383
84- const getPrefixCls = ( suffixCls ?: string , customizePrefixCls ?: string ) => {
85- if ( customizePrefixCls ) {
86- return customizePrefixCls
87- }
88- const mergedPrefixCls =
89- config . prefixCls || parentConfig . prefixCls || defaultPrefixCls
90- return suffixCls ? `${ mergedPrefixCls } -${ suffixCls } ` : mergedPrefixCls
91- }
84+ const getPrefixCls = React . useCallback (
85+ ( suffixCls ?: string , customizePrefixCls ?: string ) => {
86+ if ( customizePrefixCls ) {
87+ return customizePrefixCls
88+ }
89+ const mergedPrefixCls =
90+ config . prefixCls || parentConfig . prefixCls || defaultPrefixCls
91+ return suffixCls ? `${ mergedPrefixCls } -${ suffixCls } ` : mergedPrefixCls
92+ } ,
93+ [ config . prefixCls , parentConfig . prefixCls ]
94+ )
9295
9396 return (
9497 < ConfigContext . Provider
You can’t perform that action at this time.
0 commit comments