Skip to main content

#New Releases #Spring23

 

As salesforce documentation mentions,

if:true and if:false will beDeprecated. The if:true and if:false directives are no longer recommended. They may be deprecated and removed in the future. Use lwc:if, lwc:elseif, and lwc:else instead. 

the link is : https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_directives

 

I don't recommend this because there is some limitation about lwc:if & lwc:else. For example.

<template>

<template if:true={testVariable}>

show true

</template>

<br/>

test show other information

<br/>

<template if:false={testVariable}>

show false

</template>

</template>

This is AS-IS demo in our system, after lwc:if release, how should I quickly replace? As salesforce suggestion, lwc:if replaces to if:true and lwc:else replace to if:false. but below code will occurs error because 'lwc:else' directive must be used immediately after an element with 'lwc:if' or 'lwc:elseif'.@Release Team

<template>

<template lwc:if={testVariable}>

show true

</template>

<br/>

test show other information

<br/>

<template lwc:else>

show false

</template>

</template>

3 comments
  1. Feb 7, 2023, 1:48 AM

    @Davis Johnson

    Don't know if I misunderstand the meaning of may be removed in the future, My understanding about this is that they will be no used and other reference must be also replaced with lwc:if / lwc:else.  If my understanding is incorrect, please let me know, thanks.

0/9000