Object trigger based on component

ecs.registerComponent({
  name: 'mergeHandler',
  schema: {
    // collisionComponentTarget: ecs.string,
    object2: ecs.eid,
    entityToSpawn: ecs.eid,
    scale: ecs.f32,
    spawnPositionY: ecs.f32,
  },
  schemaDefaults: {
    scale: 1.0,
    spawnPositionY: 1,
    collisionComponentTarget: '',
  },

  add: (world, component) => {
    world.events.addListener(component.eid, ecs.physics.COLLISION_START_EVENT, ({data}) => {
      console.log('collision: ', data)
      ...
    if (component.schema.object2 === data.other) {
        console.debug('touched!')
        spawnObject()
      }

I am currently trying to create this workflow: Object with a specific component (or attribute within component, not sure what would be the best practice yet) collides with this.obj (component.eid) to spawn something else. As of right now, my code is detecting collision with component.eid and object2. I have been looking through the documentation, but I am not too sure how to get/read a certain component attached to a specific object. Would I be using getAttribute() for this? It seems to get getting schemaAttributes rather than component name.