3

In trailhead Build a Bear-Tracking App with Lightning Web Components (https://trailhead.salesforce.com/content/learn/projects/lwc-build-flexible-apps/record-list?trail_id=build-lightning-web-components) when I edit bearList.js

import { LightningElement, wire } from 'lwc';
import ursusResources from '@salesforce/resourceUrl/ursus_park';
/** BearController.getAllBears() Apex method */
import getAllBears from '@salesforce/apex/BearController.getAllBears';
export default class BearList extends LightningElement {
    @wire(getAllBears) bears;
    appResources = {
        bearSilhouette: ursusResources +'/img/standing-bear-silhouette.png',
    };
}

then the component does not display anymore (was displaying with the previous version described in trailhead) If I add it in the page builder I get the error

afterRender threw an error in 'c:bearList' [e[Ei] is not a function]

enter image description here

  • 2
    I figured it out on .html file bears must be replaced by bears.data – Marie Tourne Feb 25 at 10:46
  • You should add that as an answer so that this question stands resolved. – Jayant Das Feb 25 at 15:43
  • Unfortunately I cannot post answers from my account – Marie Tourne Feb 26 at 15:17
  • @MarieTourne I'll do it for you! Accept my answer :) – DarkSkull May 22 at 9:46
3

In your .html file bears must be replaced by bears.data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.