These LWC recipes showcase using 3 common wire adapters: createRecord
to create a record, deleteRecord
to delete a record and getRecordCreateDefaults
to get default values to create a record.
<aside> 📢 Please remember, that with these wire adapters, you do not need to code Apex server code.
</aside>
You must follow the official documentation links provided for every recipe because there are many options that are not shown in the code that you need to be aware.
These recipes can be found in the Data Service tab:
LWC LdsGenerateRecordInputForCreate
Before, you deep dive into this beefy topic, I recommend you understand and have delighted with the Recipes in the Contacts Tab .
Specially check this one LWC wireGetRecordStaticContact because is the simplest recipe that shows how to use a wire adapter.
These LWCs use some advanced Javascript concepts and some common techniques that you will use frequently as promises.
Before Spring ‘24 LWC recipes used to use Promises asyIf you are unfamiliar on what a Promise is, just watch this 100’’ video:
https://www.youtube.com/watch?v=RvYYCGs45L4
Finally, read this article to get an in-depth explanation on how to handle errors during the LWC lifecycle: