Call child LWC component function from parent LWC functionIn this post we will see how to fire or invoke function which is in child component when some event occurred on parent component in lwc.
In our project requirements we may get a situation to call Child Lightning web component function from corresponding parent Lwc component when some event occurs like button click.
If we want to call child component function then
- Child LWC component function should be public (decorated with @api).
- On parent function we need to get child component by name(using template.querySelector) and then we should invoke child function (We should give same function name defined in child).
Create test lightning app