useSelections
The hook for managing selections

Basic Example

This below example returns the current selections and a function for clearing selections
1
import { useSelections } from "@motor-js/engine"
2
3
const Selections = () => {
4
const { selections, clearSelections } = useSelections();
5
6
return (
7
<button onClick={clearSelections}>
8
Clear Selections
9
</button>
10
);
11
};
12
13
export default Selections;
Copied!

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 modified 9mo ago