function useA11yMessageStatus(
  getA11yStatusMessage,
  options,
  dependencyArray,
  environment = {},
) {
  const document = environment.document
  const isInitialMount = useIsInitialMount()

  // Adds an a11y aria live status message if getA11yStatusMessage is passed.
  useEffect(() => {
    if (!getA11yStatusMessage || isInitialMount || isReactNative || !document) {
      return
    }

    const status = getA11yStatusMessage(options)

    updateA11yStatus(status, document)

    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, dependencyArray)

  // Cleanup the status message container.
  useEffect(() => {
    return () => {
      updateA11yStatus.cancel()
      cleanupStatusDiv(document)
    }
  }, [document])
}
Adds an a11y aria live status message if getA11yStatusMessage is passed.
@param {(options: Object) => string} getA11yStatusMessage The function that builds the status message.
@param {Object} options The options to be passed to getA11yStatusMessage if called.
@param {Array<unknown>} dependencyArray The dependency array that triggers the status message setter via useEffect.
@param {{document: Document}} environment The environment object containing the document.