How to use @rooks/use-toggle - 4 common examples

To help you get started, we’ve selected a few @rooks/use-toggle 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 imbhargav5 / rooks / packages / storybook / src / toggle.js View on Github external
function ToggleDemo() {
  const [value1, toggleValue1] = useToggle();
  const [value2, toggleValue2] = useToggle(true);
  const [value3, toggleValue3] = useToggle("start", customToggleFunction);

  return (
    <>
      <section>
        <h3>Base</h3>
        <button>{value1.toString()}</button>
        <hr>
      </section>
      <section>
        <h3>Initial true</h3>
        <button>{value2.toString()}</button>
        <hr>
      </section>
      <section>
        <h3>Custom values</h3></section>
github imbhargav5 / rooks / packages / storybook / src / toggle.js View on Github external
function ToggleDemo() {
  const [value1, toggleValue1] = useToggle();
  const [value2, toggleValue2] = useToggle(true);
  const [value3, toggleValue3] = useToggle("start", customToggleFunction);

  return (
    &lt;&gt;
      <section>
        <h3>Base</h3>
        <button>{value1.toString()}</button>
        <hr>
      </section>
      <section>
        <h3>Initial true</h3>
        <button>{value2.toString()}</button>
        <hr>
      </section>
      <section>
        <h3>Custom values</h3>
        <button>{value3}</button></section>
github imbhargav5 / rooks / packages / storybook / src / toggle.js View on Github external
function ToggleDemo() {
  const [value1, toggleValue1] = useToggle();
  const [value2, toggleValue2] = useToggle(true);
  const [value3, toggleValue3] = useToggle("start", customToggleFunction);

  return (
    &lt;&gt;
      <section>
        <h3>Base</h3>
        <button>{value1.toString()}</button>
        <hr>
      </section>
      <section>
        <h3>Initial true</h3>
        <button>{value2.toString()}</button>
        <hr>
      </section>
      <section></section>
github imbhargav5 / rooks / packages / storybook / src / raf.js View on Github external
function UseRafDemo() {
  const [shouldRun, toggleShouldRun] = useToggle(true);
  const myRef = useRef();
  const canvasRef = useRef();
  useRaf(() => {
    if (canvasRef && canvasRef.current) {
      const screenRatio = window.devicePixelRatio || 1;
      let angle = updateAngle();
      const canvas = canvasRef.current;
      var ctx = canvas.getContext("2d");
      ctx.save();
      ctx.clearRect(0, 0, canvasRef.current.width, canvasRef.current.height);
      ctx.scale(screenRatio, screenRatio);
      ctx.fillStyle = "midnightblue";
      ctx.globalAlpha = 1;
      ctx.fillRect(0, 0, canvasRef.current.width, canvasRef.current.height);
      ctx.fillStyle = "yellow";
      ctx.lineWidth = 2;

@rooks/use-toggle

A React Hooks package for toggle

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular @rooks/use-toggle functions