How do you insert an Element
into the DOM via a bdAttach?
class Foo extends Component {
bdElements() {
return e.div(
e.div(
{ bdAttach: 'contentGoesHere' }
),
);
}
insertContent() {
const content = e.span('content');
// WHAT GOES HERE, TO INSERT THE CONTENT INTO this.contentGoesHere ?
}
}
You have two choices depending upon whether
content
is (A) just a plain old DOM tree (perhaps only one node as depicted in your question), or (B) a Component that you intend to manage.Case A
Either of these examples for Case A are fine and real and largish programs will have a few of these...though this pattern is not common.
Case B
One of the examples below is an antipattern.