Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<template if:true={showTom}>
<img src="https://vignette.wikia.nocookie.net/tomandjerry/images/3/33/Tom_cat.png/revision/latest?cb=20111113021359"/>
</template>
<template if:false={showTom}>
<img src="http://pngimg.com/uploads/tom_and_jerry/tom_and_jerry_PNG56.png"/>
</template>
</template>
import { LightningElement } from 'lwc';
export default class HelloConditionalRendering extends LightningElement {
showTom = false;
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="TomAndJerry">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.