I am trying to access nested JSON objects such as the code below, which works currently.
<img id="inactive-drive2" src='/src/assets/image/InActiveDrive.png' className={info.data.drives[1]?.isActive ? "d-none" : ""} />
If I change my code to this :
<img id="inactive-drive2" src='/src/assets/image/InActiveDrive.png' className={info.data.drives[1].isActive ? "d-none" : ""} />
get me an error that isActive field is not defined.
I think info.data.drives[1].isActive is correct but when running the app gets an error.
Why does it work this way?