Which of these options is correct in a binding in Lit

This question is poorly posed, because they should have told you where to use that code (the 4 answers indicated), since the syntax would be different if it is directly in an HTML code or in the Javascript code of the template of another Lit component, Angular component (for example) or any other place where you could end up using the custom element.

If it is the template of another Lit component, which by common sense I would say is what you are being asked, my answer would be that none of the indicated proposals is valid.

Trying to understand something I see two possibilities:

  1. That you have copied and pasted the answers wrong
  2. That the teacher who has taken the exam has made a mistake when writing the answers, in addition to not having made the context of the question clear.

In my opinion, as the correct answer, I think the professor had meant to write this.

However, it’s still a very twisted way to write a Lit component template. No one programs like that, since inside a component you wouldn’t bind a return value over a JSON.parse(), but an object directly.

If the teacher wanted to know whether or not you know that to bind objects you need the dot notation, he could have done something simpler and not mislead the poor students with code that doesn’t work that way in practice.

I recommend that you study better at EscuelaIT. Instead of exams you have a final practice which is to release a component to the community and show that you know it by publishing your own work as free software.

Loading Facebook Comments ...
Loading Disqus Comments ...