Data is not seen in the lifecycle hooks for the component inside a collection

I found out another way to get the components data with raw query using strapi.db.connection() in lifecycles hook. I think you can also try like that. There may be another feasible solution for that. Welcome any suggestions.

const user = await strapi.db.connection
  .select("*")
  .from(`${process.env.DATABASE_SCHEMA}.components_userinfo_user_infos`)
  .where({ id: data.userInfo.id });