How to use the reakit-system.useProps function in reakit-system

To help you get started, we’ve selected a few reakit-system 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-playground / src / PlaygroundPreview.tsx View on Github external
return () => clearTimeout(timer);
  }, [
    options.code,
    options.modules,
    options.componentName,
    renderChildren,
    handleError,
    unmount
  ]);

  React.useEffect(() => {
    // Ensure that we unmount the React component when the effect is destroyed.
    return () => unmount();
  }, [unmount]);

  htmlProps = useProps("PlaygroundPreview", options, htmlProps);

  return (
    
      <div>
        {error &amp;&amp; }
        <div>{renderChildren(rendered)}</div>
      </div>
    
  );
}
github reakit / reakit / packages / reakit-playground / src / ErrorMessage.tsx View on Github external
export function ErrorMessage({
  error,
  unstable_system,
  ...htmlProps
}: ErrorMessageOptions &amp; ErrorMessageHTMLProps) {
  const options = useOptions(
    "ErrorMessage",
    { error, unstable_system },
    htmlProps
  );

  htmlProps = useProps("ErrorMessage", options, htmlProps);
  htmlProps = useBox(options, htmlProps);

  return <pre>{options.error.toString()}</pre>;
}
github reakit / reakit / packages / reakit-playground / src / PlaygroundEditor.tsx View on Github external
theme,
      tabSize,
      mode,
      autoRefresh,
      maxHeight
    },
    htmlProps
  );

  const [enabled, setEnabled] = React.useState(false);
  const enabledRef = useLiveRef(enabled);
  const _readOnly =
    typeof options.readOnly !== "undefined" ? options.readOnly : !enabled;
  const [ready, setReady] = React.useState(false);

  htmlProps = useProps(
    "PlaygroundEditor",
    { ...options, readOnly: _readOnly },
    htmlProps
  );

  const className = [
    htmlProps.className,
    !enabled && !options.readOnly && "disabled"
  ]
    .filter(Boolean)
    .join(" ");

  React.useEffect(() => {
    const id = requestAnimationFrame(() => setReady(true));
    return () => cancelAnimationFrame(id);
  }, []);