+ Start a Discussion
sai ramsai ram 

I have two lwc components each have recordId based on first component how to pass the recordId to second component

Danish HodaDanish Hoda
Hi Dinesh,
Are you having parent-child relationship b/w the LWCs or navigating from one to the other?
sai ramsai ram
Hi Danish,
Based on recordId iam able to show records in Details just how to pass recordId from parent.i dont want include child component in parent component.
Danish HodaDanish Hoda
This is a condition of sibling components in LWC, you need to use pub-sub model for data communication.
Please refer this:  https://thesalesforcedev.blogspot.com/2019/07/pubsub-event-in-lightning-web-component.html
SHUCHI TIWARI 5SHUCHI TIWARI 5
Hello,
I am facing the same issue. I am able to pass recordId from Parent to first child but it is not passed to teh second child.

<template>
    <c-hardware-order record-id={recordId}></c-zettle-hardware-order>
    <c-hardware-order-info record-id={recordID}></c-zettle-hardware-order-info>
</template>

in Parent Js :
import { api, LightningElement } from 'lwc';
export default class Hardware extends LightningElement {
    @api recordId;
}

in both child js : 
    @api recordId;

Still the record Id is not passed to the second child but it is passed to first child.
Any help is appreciated.

Thanks
Danish HodaDanish Hoda
Hi Suchi, may I know the reason why you are passing recordID in <c-hardware-order-info component?
the variable you are using in JS is recordId, not recordID