Description
There is currently some misunderstandings common to developers that are not addressed in the documentation. Some is covered in the MDN docs but could use elaboration.
Best practices list:
- The constructor should primarily be used for setting up initial values and assigning event handlers
- The connectedCallback may fire while the constructor is still executing as the constructor is not blocking
- The connectedCallback should be used for any component setup that is not related to the initial values
- Identify common scenarios and how to overcome them if data is coming in after initial values have been applied - an example of an indeterminate progress element may be useful here.
- It is expected that change handlers for attributes and observed properties fire during initialization, from
null to a value for attributes and undefined to a value for observed properties
- Could there be a case for no-op on an observed property here during first run? This could avoid a conditional check.
Description
There is currently some misunderstandings common to developers that are not addressed in the documentation. Some is covered in the MDN docs but could use elaboration.
Best practices list:
nullto a value for attributes andundefinedto a value for observed properties