In Aura, it's standard practice to call an @AuraEnabled
Apex method for all database CRUD operations.
With LWC, Trailhead promotes the use of lightning/uiRecordApi (User Interface API under the hood) for retrieving records from the database.
Tantalizingly, the lightning/uiRecordApi documentation makes reference to several methods that seem to be tailored toward more advanced use cases, e.g.:
- createRecord()
- createRecordInputFilteredByEditedFields()
- generateRecordInputForCreate()
- generateRecordInputForUpdate()
- updateRecord()
I'd like to use a standard set of tools for forms that create, read, update and delete records, but I'm concerned about the fact that they have been largely omitted from Trailhead examples, and haven't been much discussed on StackExchange. (Note: there is one createRecord() example in the lwc-recipes)
What factors should I consider before I use these APIs? For those who have attempted to use them, what advantages/disadvantages do they have in comparison with Apex?