Why I'm getting undefined username in this one?

function Socialpostdetail() {

    const [item, setItems] = useState([])

    let {resultId} = useParams();

    const { Moralis, isInitialized } = useMoralis();

    console.log(resultId)

    const { data, error, isLoading } = useMoralisQuery("Posts");

useEffect(async () => {

    const Posts = Moralis.Object.extend("Posts");

const query = await new Moralis.Query(Posts);

query.equalTo("title", resultId);

const object = await query.first();

const results = JSON.stringify(object, null, 2)

const finalResult = JSON.parse(results)

setItems(finalResult)

}, [])

console.log(item.author.username)

Iā€™m trying to render this in where I have an item which contains an author object, I can render everything in the object correctly, but the author as it comes from another class it says that it is undefined. Can someone help me with this?

you could add some logging in that useEffect, like: console.log(JSON.stringify(object)) to see if you have the right data there

yes it is correct the data and everything, it should work but the error jumps

the error seems strange related to that line, you could try to do some debugging, to be sure that the problem is on that line, to see what parameters you have there, you can try with a small image and print it on console