useSelections

The hook for managing selections

Basic Example

This below example returns the current selections and a function for clearing selections

import { useSelections } from "@motor-js/engine"

const Selections = () => {
  const { selections, clearSelections } = useSelections();

  return (
    <button onClick={clearSelections}>
      Clear Selections
    </button>
  );
};

export default Selections;

Selections Options

No options can be passed into the hook

Selections Properties

The following properties are returned from the hook

  • selections: Array<selectionResult>

    • An array of selection objects

  • clearSelections: Function

    • Function to clear all selections

  • previousSelection: Function

    • Function to jump to the previous selection state

  • nextSelection: Function

    • Function to jump to the next selection state

Selection Result Properties

The following properties are returned from the selections array

Last updated