I am trying to create a custom LWC where I am showing 3 records, below that I am trying to implement View All functionality. It should show the total records in next tab.
Now, can someone suggest how to implement View All functionality ?
Using NavigationMixin, seems there is no type to call child LWC component. Any other best approach to share ?
#Sales Cloud #Salesforce #Trailhead Challenges #Trailblazers #Navigation Menu
Hi Teja,
Remember that you don't exactly navigate to components. Components are all part of the same page, and they can be shown or hidden as required.
Assuming you have a component showing X records, out of a total of Y records, I would personally consider building it as a parent component which performs the loading of X or Y records (depending on a button press), and then uses a child component to display each individual loaded record. I don't think there is a real need to have one component that shows X records, and a second component that shows Y records.
But even if, theoretically, there was such a need, you would not need to change the page or deal with navigation at all. You'd just want to show or hide this child component based on whether or not the button was pressed:
<template if:true={viewAll}>
<your-component-here></your-component-here>
</template>