How to use the reakit-utils/splitProps.splitProps function in reakit-utils

To help you get started, we’ve selected a few reakit-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reakit / reakit / packages / reakit-system / src / createComponent.ts View on Github external
const Comp = (
    { as = type, ...props }: PropsWithAs,
    ref: React.Ref
  ) => {
    if (useHook) {
      const [options, htmlProps] = splitProps(props, keys);
      const { unstable_wrap, ...elementProps } = useHook(options, {
        ref,
        ...htmlProps
      });
      // @ts-ignore
      const asKeys = as.render ? as.render.__keys : as.__keys;
      const asOptions = asKeys ? splitProps(props, asKeys)[0] : {};
      const element = useCreateElement(as, { ...elementProps, ...asOptions });
      if (unstable_wrap) {
        return unstable_wrap(element);
      }
      return element;
    }
    return useCreateElement(as, props);
  };
github reakit / reakit / packages / reakit-system / src / createComponent.ts View on Github external
const Comp = (
    { as = type, ...props }: PropsWithAs,
    ref: React.Ref
  ) => {
    if (useHook) {
      const [options, htmlProps] = splitProps(props, keys);
      const { unstable_wrap, ...elementProps } = useHook(options, {
        ref,
        ...htmlProps
      });
      // @ts-ignore
      const asKeys = as.render ? as.render.__keys : as.__keys;
      const asOptions = asKeys ? splitProps(props, asKeys)[0] : {};
      const element = useCreateElement(as, { ...elementProps, ...asOptions });
      if (unstable_wrap) {
        return unstable_wrap(element);
      }
      return element;
    }
    return useCreateElement(as, props);
  };