@laserware/sword
    Preparing search index...

    Function useSelector

    • Creates an object with a value property which contains the current value of the specified selector.

      Type Parameters

      • R

        Return value from the selector.

      • S

        Redux state definition.

      Parameters

      • selector: Selector<S, R>

        Selector function either returned by createSelector or a simple state accessor.

      • ...args: any[]

        Additional args to pass to selector.

      Returns { value: R }

      An object with a reactive value property that represents the return value of the specified selector.

      <script>
      import { useSelector } from "@laserware/sword";

      import { selectSomeValue } from "./my-redux-selectors";

      const someValue = useSelector(selectSomeValue);

      function handleClick() {
      console.log(someValue.value);
      }
      </script>

      <button onclick={handleClick}>Click Me</button>