@joint/react
    Preparing search index...

    Function useUpdateElement

    • Experimental

      Set the element attribute in the graph. It returns a function to set the element attribute.

      It must be used inside the GraphProvider.

      Type Parameters

      Parameters

      • id: ID

        The ID of the element.

      • attribute: Attribute

        The attribute to set.

      Returns (value: Attributes[Attribute] | Setter<Attributes[Attribute]>) => void

      The function to set the element attribute. It can be reactive.

      It can be used in three ways:

      1. Use empty hook and define ID, attribute, and value inside the set function
      const setElement = useUpdateElement();
      setElement('element-id', 'position', { x: 100, y: 100 });
      1. Provide ID and attribute, and use the returned function to set value
      const setElement = useUpdateElement('element-id', 'position');
      setElement({ x: 100, y: 100 });
      1. Provide ID and use the returned function to set attribute and value
      const setElement = useUpdateElement('element-id');
      setElement('position', { x: 100, y: 100 });
    • Experimental

      Set the element attribute in the graph. It returns a function to set the element attribute.

      It must be used inside the GraphProvider.

      Type Parameters

      Parameters

      • id: ID

        The ID of the element.

      Returns <Attribute extends string | number | symbol>(
          attribute: Attribute,
          value: Attributes[Attribute] | Setter<Attributes[Attribute]>,
      ) => void

      The function to set the element attribute. It can be reactive.

      It can be used in three ways:

      1. Use empty hook and define ID, attribute, and value inside the set function
      const setElement = useUpdateElement();
      setElement('element-id', 'position', { x: 100, y: 100 });
      1. Provide ID and attribute, and use the returned function to set value
      const setElement = useUpdateElement('element-id', 'position');
      setElement({ x: 100, y: 100 });
      1. Provide ID and use the returned function to set attribute and value
      const setElement = useUpdateElement('element-id');
      setElement('position', { x: 100, y: 100 });
    • Experimental

      Set the element attribute in the graph. It returns a function to set the element attribute.

      It must be used inside the GraphProvider.

      Type Parameters

      Returns <Attribute extends string | number | symbol>(
          id: ID,
          attribute: Attribute,
          value: Attributes[Attribute] | Setter<Attributes[Attribute]>,
      ) => void

      The function to set the element attribute. It can be reactive.

      It can be used in three ways:

      1. Use empty hook and define ID, attribute, and value inside the set function
      const setElement = useUpdateElement();
      setElement('element-id', 'position', { x: 100, y: 100 });
      1. Provide ID and attribute, and use the returned function to set value
      const setElement = useUpdateElement('element-id', 'position');
      setElement({ x: 100, y: 100 });
      1. Provide ID and use the returned function to set attribute and value
      const setElement = useUpdateElement('element-id');
      setElement('position', { x: 100, y: 100 });