License validation in forge custom UI

Hi Everyone,

I’m new to Forge platform, I’m trying to validate the app license using below snippet but it always getting false value when try to access context.license.active

import { view } from "@forge/bridge";

const context = await view.getContext();

function App(){
const [license, setLicense] = useState(true)
//inside useEffect function
setLicense(context?.license?.active);

 return (
      <div>
        <div className='ttlbody'>
          <div className={license !== true ? 'license' : 'hide'}> 
            <p><FaExclamationTriangle className='alerticon'/> <License warning message></p>
          </div>
.....
}

Thanks in advance,
Leo

You need to publish it to the marketplace to have active license