I am new to Vue and eager to learn. I am attempting to conditionally render a component like so:
<div>
<Map v-if="bool" mapSrc="src1.jpg" :idList="idList1" :data="dataVariable1"></Map>
<Map v-else mapSrc="src2.jpg" :idList="idList2" :data="dataVariable2"></Map>
</div>
My objective is to display the same component with different props based on the value of the bool variable. When bool is true, it should show the first component. However, when bool becomes false, it should switch to rendering the second option. The props appear to change correctly, but toggling the bool does not trigger the mounted() hook again. This indicates that component1 is not unmounting, instead, it only changes the props.
What I want is for the component to be re-rendered completely when bool switches to false, so that it starts fresh and isolated from the previous state of component 1.
How can I achieve this functionality?