function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GÜNES AdminGÜNES Admin 

How to share variable value between two LWC on the same Lightning Record Page?

Hi everyone!

This is custom object development.

The question is how to share variables between LWC on the same Lightning Record Page?

In this particular context:
A variable value on first component (LWC #1) will decide if the Lightning Card on the second component (LWC #2) will be visible or not.

But, I am not sure how I can pass on a dynamic variable value from one LWC to another. Because the visibility should change based on the variable value.

Thank you!
 
Naveen KNNaveen KN
Are these lightning web components are in the heirarchy? like a parent and child. 
If they are not in the heirarchy you can use lightning message service for this. More details in my article https://www.codekiat.com/2020/08/Implement-lightning-message-service-lms-salesforce.html