question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attach arbitrary dom elements

See original GitHub issue

Hi, Is there a supported way of attaching arbitrary dom elements in components? Tried using this.base.appendChild but it seems to cause a mess with the caching of components/elements.

In my case I want to use a datepicker that has nothing to do with preact or react wrapping it in a component for easy use.

Any help appreciated Thanks

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kruczycommented, Mar 15, 2016

well @developit you’re the most responsive and helpful maintainer I came across 👍 and I mean it!

Just did what you suggested and it works perfectly!

Will throw in a componentDidUnmount to cleanup after as well

Thanks alot

1reaction
kruczycommented, Mar 15, 2016

@developit thanks for this! that is very helpful, will try this in a sec

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I add arbitrary properties to DOM objects? - Stack Overflow
Yes, you can add your own properties to DOM objects, but remember to take care ... HTML5 introduced a valid way of attaching...
Read more >
Attach arbitrary dom elements #93 - preactjs/preact - GitHub
Hi, Is there a supported way of attaching arbitrary dom elements in components? Tried using this.base.appendChild but it seems to cause a ...
Read more >
Using custom elements - Web Components | MDN
In this case we attach a shadow root to the custom element, use some DOM manipulation to create the element's internal shadow DOM...
Read more >
Attributes and properties - The Modern JavaScript Tutorial
When the browser loads the page, it “reads” (another word: “parses”) the HTML and generates DOM objects from it. For element nodes ......
Read more >
7 - In D7 how can I append an element to the DOM via ajax on ...
First visit example.com/ajax/insert to verify your content is being printed out. Your overall JS structure looks odd, plus you have a lot of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found