Properties, variables

The @api decorator marks recordId as a public reactive property. A public property is part of the public API for the component, which means that it can be set in Lightning App Builder, or by a parent component that uses the component in its markup.

The @track decorator marks property as a private reactive property, also known as a tracked property. These properties are used to track internal component state and aren’t part of the component’s public API.

Ractive variables are prefixed with $. 
Because $recordId is prepended with a $, when its value changes, the wire service gets new data and provisions it to the component. When new data is provided, the wired function gets invoked. That process updates the @track properties, which in turn cause a rerender.

Conditional rendering

<template if:false={isFirstPage}>
    <lightning-button-icon icon-name="utility:chevronleft" onclick={previousHandler}></lightning-button-icon>

js controller

import { LightningElement, api } from 'lwc';
export default class Paginator extends LightningElement {
    /** The current page number. */
    @api pageNumber;
    get isFirstPage() {
        return this.pageNumber === 1;

Iteration over the list of records

<template for:each={} for:item="property">
    <c-property-tile property={property} key={property.Id} 

Custom utility module 

/* utils.js */
 * Returns whether provided value is a function
 * @param {*} value - the value to be checked
 * @return {boolean} true if the value is a function, false otherwise
export function isFunction(value) {
    return typeof value === 'function';


/* libcaller.js */
import { LightningElement, track } from 'lwc';
// import the library
import { isFunction } from 'c/utils';
export default class LibCaller extends LightningElement {
    @track result;
    checkType() {
        // Call the imported library function
        this.result = isFunction(
            function() {
                console.log('I am a function');

Import the static resource in JavaScript

import resourceName from '@salesforce/resourceUrl/resourceName';



© Paweł Woźniak