Victor Shelepen
Victor Shelepen

Reputation: 2256

Pass object by reference to nested lit-element

There are few nested elements and a main state object. I see that there is no way pass an object by reference like at Angular for example to be available at the bottom. I see that it is possible to work through the global environment. But it is not a clean solution.

Upvotes: 0

Views: 1238

Answers (1)

daKmoR
daKmoR

Reputation: 1864

if you want to pass the actual object as a property then you need to use the "dot notation" of lit-html.

<my-el .data=${dataObject}></my-el>

this is basically the same as doing

document.querySelector('my-el').data = dataObject;

Upvotes: 1

Related Questions