refactor: change usecontext of divider prepare for v5 (#34246)

Co-authored-by: zengguhao.zgh <zengguhao.zgh@alibaba-inc.com>
This commit is contained in:
Long Hao (龙濠) 2022-03-02 10:10:29 +08:00 committed by GitHub
parent ee6c23c584
commit cfca106c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';
export interface DividerProps {
prefixCls?: string;
@ -14,9 +14,9 @@ export interface DividerProps {
plain?: boolean;
}
const Divider: React.FC<DividerProps> = props => (
<ConfigConsumer>
{({ getPrefixCls, direction }: ConfigConsumerProps) => {
const Divider: React.FC<DividerProps> = props => {
const { getPrefixCls, direction } = React.useContext(ConfigContext);
const {
prefixCls: customizePrefixCls,
type = 'horizontal',
@ -62,8 +62,6 @@ const Divider: React.FC<DividerProps> = props => (
)}
</div>
);
}}
</ConfigConsumer>
);
};
export default Divider;