Skip to content

Instantly share code, notes, and snippets.

@chancyk
Last active December 2, 2021 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chancyk/718e162960a02dbeb69c9e9453e8a0e7 to your computer and use it in GitHub Desktop.
Save chancyk/718e162960a02dbeb69c9e9453e8a0e7 to your computer and use it in GitHub Desktop.
const ComponentButton = (props, { $onMounted }) => {
$onMounted(() => {
console.log("[TEST] COMPONENT BUTTON MOUNTED");
});
return () => (
<button
class="button button-fill button-preloader button-loading"
onclick={() => props.fnClicked()}>
<span class="preloader"></span>
<span>{props.label}</span>
</button>
)
}
const ComponentParent = (props, { $onMounted }) => {
$onMounted(() => {
console.log("[TEST] COMPONENT PARENT MOUNTED");
});
return () => (
<ComponentButton
label='Click Me'
fn-clicked={props.fnButtonClicked}>
</ComponentButton>
);
}
export default (props, { $on, $onMounted }) => {
$onMounted(() => {
console.log("[TEST] MOUNTED");
});
$on('page:init', () => {
console.log("[TEST] PAGE INIT");
});
function doNothing() {
console.log("[TEST] Clicked!");
}
return () => (
<div class="page">
<div class="page-content">
<ComponentParent fn-button-clicked={doNothing}></ComponentParent>
</div>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment