useSelections
The hook for managing selections
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;
No options can be passed into the hook
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
The following properties are returned from the selections array
Last modified 2yr ago