Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Last active August 4, 2020 20:29
Show Gist options
  • Save justin-lyon/0cabd73aab12f6b5241e3b35a2927af2 to your computer and use it in GitHub Desktop.
Save justin-lyon/0cabd73aab12f6b5241e3b35a2927af2 to your computer and use it in GitHub Desktop.
LC4VF with LWC Example
<apex:page>
<apex:includeLightning />
<div id="mount"></div>
<script type="text/javascript">
const myLwcProps = {
prop1: 1,
isSuperAwesomeBool: true
}
const afterMountCallback = cmp => {
// do Stuff after mount - attach event handler etc
}
$Lightning.use("c:MyAuraApp", () => {
$Lightning.createComponent("c:MyLwc",
myLwcProps,
"mount", // id of the element in the page to mount your component in
afterMountCallback
})
</script>
</apex:page>
<aura:application access="global" extends="ltng:outApp">
<aura:dependency resource="c:MyLwc" />
</aura:application>
import { LightningElement, api } from 'lwc'
export default class MyLwc extends LightningElement {
@api prop1
@api isSuperAwesomeBool
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment