Created
March 13, 2023 11:59
-
-
Save realiarthur/b429ccee1fa08f35dbd15e78580510ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef } from 'react' | |
import { render } from 'lit-html' | |
export const RenderLit = ({ html }) => { | |
const container = useRef(null) | |
useEffect(() => { | |
const element = container.current | |
if (element) { | |
render(html, element) | |
} | |
}, [html]) | |
return <div ref={container}></div> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Usage = () => { | |
const boolean = true | |
const callback = ()=>{} | |
return <RenderLit | |
html={html`<my-web-component | |
?boolean=${boolean} | |
.callback=${callback} | |
></set-password-input>`} | |
/> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment