useBase.js 538 B

1234567891011121314
  1. import * as React from 'react';
  2. import { ConfigContext } from '../../config-provider';
  3. function useBase(customizePrefixCls, direction) {
  4. const {
  5. getPrefixCls,
  6. direction: rootDirection,
  7. renderEmpty
  8. } = React.useContext(ConfigContext);
  9. const mergedDirection = direction || rootDirection;
  10. const prefixCls = getPrefixCls('select', customizePrefixCls);
  11. const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
  12. return [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty];
  13. }
  14. export default useBase;