Screen reader is not reading out div text

I have chat application written in react. So when user receives a message from chatbot the screen reader should automatically read out the message when component is rendered and only if the message is equal to some specific text.
Here is the current code I have.

import React, { Component } from 'react';

class SomeComponent extends Component {
  render() {
    const { text } = this.props;

    return (
      <div>
        <div aria-live={text === 'some text' ? 'polite' : 'off'}>
          {text}
        </div>
      </div>
    );
  }
}

export default SomeComponent;

I tried using the aria-live but it didn’t work.
I am using NVDA as screen reader.