passing parameters to a react component from a parent component

I have a problem that's really stumped me. I have a component from a parent component. In the parent component, i'm trying to pass values into the child component.

I pass the properties in, but don't have access to them in VSCode intellisence, which means that I'm not seeing them in the scope of my child component.

Here's what the way I'm calling my child component:

 <Modal person={{ name: 'Lin Lanying', imageId: '1bX5QH6' }}
      size={100}/>
           

In my child component (called Modal.js), I'm trying to access them through the following code:

export const Modal = (props)  => {
  const test = this.person.name;

}

and there are no properties like this available.

Can you guys help?

Upvotes: 0

Views: 61

Answers (1)

ShoaibAh
ShoaibAh

Reputation: 197

In your Modal component, please use props.person.name

Upvotes: 2

Related Questions