You need to sign in to do that
Don't have an account?
Girbson Bijou 8
LWC Parent to Child
Please, help me to clearly understand the logic of Parent to Child Communication in LWC.
In all all articles i read it like they say communication from parent to child is:
- making a property of a child public to be accessed in the parent.
- calling the method of Child Component from the Parent Component.
They finally say: Parent to Child is passing value from parent to child.
which make me really confused.
for me There is a different between passing value from parent to Child and Access property of child in/from the parent.
How can you help me to be cleared.
In all all articles i read it like they say communication from parent to child is:
- making a property of a child public to be accessed in the parent.
- calling the method of Child Component from the Parent Component.
They finally say: Parent to Child is passing value from parent to child.
which make me really confused.
for me There is a different between passing value from parent to Child and Access property of child in/from the parent.
How can you help me to be cleared.
There are primarily three ways of communication between lwc components.
1. between related components
1-a: from parent to child we use a public method to send values these are decorated with @api annotation.
1-b: from child to parent we do this using events.
2. between unrelated components, we do this using pubsub model.
For more information, you can check this article: https://amitsalesforce-com.medium.com/lightning-web-components-lwc-events-communicate-with-events-85bd325f71b4
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.