cristianbote/goober

How to put styles inside web component?

m4rvr opened this issue · 1 comments

m4rvr commented

Hey!

I have a web component and want to add the styled to a <style> tag inside the root of it.

Creating a custom styled with const styled = styled.bind({ target: target }) doesn't work because the target isn't there on the first render of the component hence it falls back to the <head> again.

Any idea what I can do to make this work?

The target usually is the head element. What are you passing as a target when you're binding? Take a look at this example: https://codesandbox.io/s/immutable-moon-x7k7xwz6mz