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
Pradeep SinghPradeep Singh 

Trailhead :- Superbadge (Lightning Component Framework Specialist) issue.

Hi all,
I am getting the below error while performing challenge checking for the superbadge (Lightning Component Framework Specialist)
Challenge Not yet complete... here's what's wrong: 
The "New" button isn't hidden based on whether the event.force:createRecord is supported. The BoatSearchForm component should conditionally render the New button based on the value of a component attribute that is set by its controller.

Below is my code :-

<aura:component controller="BoatSearchResults" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="Boats" type="String[]" default="All Types" />
    <aura:attribute name="showNewButton" type="boolean"/>
    
    <div class="slds-container_fluid slds-p-around--small">    
        <lightning:layout horizontalAlign="center">
           <lightning:select name="selectItem" label="">
                <option value=" " text="All Types"/>
                <aura:iteration items="{!v.Boats}" var="item">
                    <option value="{!item}" text="{!item}"/>
                </aura:iteration>  
            </lightning:select>  
            <lightning:layoutItem padding="around-medium">
                <lightning:button variant="brand" label="Search" />
                <aura:renderIf isTrue="{!v.showNewButton}">
                    <lightning:button label="New" onclick="{!c.createBoatRecord}" class="{!v.showNewButton ? '' : 'slds-hide'}"/>
                   </aura:renderIf>
            </lightning:layoutItem>
        </lightning:layout>
    </div>
</aura:component>

-------------------------------------------------------------------------------------------------------------------------------

({
    createBoatRecord : function (component, event, helper) {
        var createRecordEvent = $A.get("e.force:createRecord");
        createRecordEvent.setParams({
            "entityApiName": "Boat__c"
        });
        createRecordEvent.fire();
    },
    
    doInit: function(component){
        var checkCreate = $A.get("e.force:createRecord"); // to check if it is supported by a standalone app
        console.log('---' + checkCreate);
        if(checkCreate){
            console.log('--2-' + checkCreate);
           component.set("v.showNewButton", true);        
        }
        else{
            component.set("v.showNewButton", false); 
        }
        
        var action = component.get("c.getBoats");
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.Boats", response.getReturnValue());
            }
        });
     $A.enqueueAction(action);
   }
    
})
Best Answer chosen by Pradeep Singh
Pradeep SinghPradeep Singh
The error was due the usage of <aura:renderIf > instead of <aura:if>  as it got Deprecated.
Reference:-
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_aura_renderIf.htm