How to get useXPath

import useXPath from 'fontoxml-fx/src/useXPath.js'

Type: Function

A React hook which runs the given XPath expression on the given context and observes the result. Whenever one of the inputs changes or whenever the result of the current inputs change, the result is recomputed and returned.


# Name Type Description
1. expression String

The XPath expression to evaluate.

2. context Object | Null

The context for the XPath expression.

  Default value
3. [options] Object
  Default value


Name Type Description
[currentHierarchyNodeId] String

The current hierarchy node id of the context node to be used by fonto:current-hierarchy-node-id xpath function.

[expectedResultType] Number

One of the values defined on XPATH_RETURN_TYPES. The XPATH_RETURN_TYPES can be imported by name from this file.

[variables] Object

Any additional variables to use with the XPath.


Type: any | Null

The result of the given XPath expression in the given returnType.

Was this page helpful?