There is some description of targetFields
in the Lightning Data Service (Beta) release notes:
force:recordData includes a new attribute called targetFields, which is populated with a simplified view of the record’s fields. targetFields is automatically updated whenever Lightning Data Service detects a record change. v.targetFields.Name is equivalent to v.targetRecord.fields.Name.value. A simple way to update force:recordPreview usage to force:recordData is to change references from targetRecord to targetFields.
So its worth setting up this attribute so you have a more convenient way to reference the fields in your component e.g.:
v.targetFields.Name
instead of:
v.targetRecord.fields.Name.value
so getting rid of .fields
and .value
that would otherwise have to be present in every reference in the markup. Essentially force:recordData
is keeping two JavaScript data structures in sync for you, where the targetFields
one is generally easier and cleaner to use in the component markup.
(And it also makes replacing force:recordPreview
with force:recordData
simple.)
PS
Mohith's comment on your question contains a key point that I didn't know that makes things clearer: "Recommend using targetFields and you can drop the targetRecord". So the point is that targetRecord is only there for backward compatibility and new code is best written using targetFields only. Suggest you prompt him to post that as an answer and accept that answer instead.