Development Best Practices
  • Home
  • Clean Code
  • Apex
    • Naming Conventions
    • Triggers
    • Unit Testing
    • Principles
      • KISS
      • DRY
      • Single Responsibility
      • Open/Closed
      • YAGNI
    • Patterns
    • SOQL
    • Exception Handling
    • Magic Strings
  • Lightning Components
    • Aura
    • LWC
  • Automation
    • Process Builder
  • Salesforce DX and VSCode
  • Git Source Control
    • Install Git
    • Using Git
    • Development Workflow
      • The Rules
    • Feature Branch Workflow
Powered by GitBook
On this page
  • Avoid Lightning Data Services
  • Use Single a @Track variable
  1. Lightning Components

LWC

Avoid Lightning Data Services

Don't use Lightning Data Services unless it's for a read only requirement, and even then please get permission ahead of implementation.

Use Single a @Track variable

Where possible use a single @track variable in your JavaScript rather than creating a @track variable for each property.

@track user

Rather than:

@track userName;
@track userEmail;
@track userPhone;

This reduces the amount of code to write.

You can access properties in the HTML like this:

<lightning-input label="Name" value={user.Name} />
PreviousAuraNextAutomation

Last updated 5 years ago