Lightning Web Components Flashcards

1
Q

What happens if you try to directly modify an object passed from a parent to a child?

A

An invalid mutation error is thrown.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or false: bound properties in {} can contain spaces.

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the easiest way to work with Salesforce data in an LWC?

A

Use base Lightning components built on the Lightning Data Service (LDS).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which property of an event includes any sent data?

A

detail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the syntax for loading the account object into a variable named ACCOUNT_OBJECT?

A

import ACCOUNT_OBJECT from “@salesforce/schema/Account”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which two properties does a record page provide?

A

recordId and objectApiName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you conditionally display content in an LWC?

A

Nest a template tag(s) with the lwcI:if={someProperty}. The lwc:elseif and lwc:else properties can also be used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How would you reference a component named viewSource in markup?

A

<c-view-source>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you conditionally render markup in LWCs?

A

Use the lwc:if, lwc:elseif, and lwc:else attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the preferred, and easiest way to work with data in an LWC?

A

Lightning Data Service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In which directory are message channels stored?

A

force-app/main/default/messageChannels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the proper syntax to import a method named myMethod from MyClass as MY_METHOD?

A

import MY_METHOD from ‘@salesforce/apex/MyClass.myMethod;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a slot?

A

A placeholder for markup that a parent component passes into a component’s body.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the file name format for a message channel?

A

messageChannelName.messageChannel-meta.xml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which method is used for dispatching events?

A

dispatchEvent()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which decorator exposes a field as a public property?

A

@api

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which attribute is set to listen for an event on an input element?

A

onchange

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

True or false: if you write a setter for a public property, you must also write a getter.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What would be the property syntax to import the method named queryAccounts that is marked @AuraEnabled and part of the class AccountListController into an LWC?

A

import queryAccounts from ‘@salesforce/apex/AccountListController.queryAccounts’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which decorator marks a field as public?

A

@api

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

True or false: an LWC folder and its file must have the same name, including capitalization and underscores.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

True or false: all fields are reactive.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

True or false: an LWC file/folder must begin with a lowercase letter.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How do you control when Apex method invocation occurs in an LWC?

A

Call the method imperatively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
An array of Contact fields has been declared named FIELDS. What is the proper syntax to use these fields when wiring in to a property?
@wire(getRecord, {recordId: '$recordId', fields: FIELDS})
26
What is the syntax to create a child component named myComponent and set a public property named myProperty to the value of a primitive named test?
``
27
What decorator must be used to call an Apex method from an LWC?
@AuraEnabled
28
What would the syntax be to define an iterator named it that iterates over an array named accounts?
`