useIsPiping
This is a custom hook that listens to the isPiping
property on the pipeline context object.
The pipeline is internally storing the isPiping (boolean) status in a React ref and will trigger any assigned event listeners when changing.
useIsPiping
returns a React state and setter function and can be used like this:
Or if the setter is needed (which should rarely ever be the case)
Note that changing the isPiping
state manually will not actually trigger or abort the pipeline.
The main purpose will be to create a conditional component the renders its children (or not) based on the isPiping state.
It could then be used like this:
The above components (WhenIsPiping) and its opposite component (WhenIsNotPiping) are provided from the package.