Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Last active December 16, 2023 05:02
Show Gist options
  • Select an option

  • Save PatrickJS/74e9d9c4b8b35dc720448891e278be98 to your computer and use it in GitHub Desktop.

Select an option

Save PatrickJS/74e9d9c4b8b35dc720448891e278be98 to your computer and use it in GitHub Desktop.
how do you type qwik
/TileTemplate.tsx
15:23 warning Using "onDragStart$" as an event handler, however functions are not serializable.
Did you mean to wrap it in `$()`?
Fix the type of onDragStart$ to be PropFunction
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details qwik/valid-lexical-scope
16:21 warning Using "onDragEnd$" as an event handler, however functions are not serializable.
Did you mean to wrap it in `$()`?
Fix the type of onDragEnd$ to be PropFunction
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details qwik/valid-lexical-scope
import { Slot, component$, $ } from "@builder.io/qwik";
type Props = {
onDragStart$?: () => void;
onDragEnd$?: () => void;
};
export const TileTemplate = component$<Props>(
({ onDragStart$, onDragEnd$ }) => {
return (
<div
draggable
onDragStart$={$(onDragStart$)}
onDragEnd$={$(onDragEnd$)}
class="cursor-pointer text-center text-white"
>
<Slot />
</div>
);
},
);
import { Slot, component$, $ } from "@builder.io/qwik";
import type { PropFunction } from "@builder.io/qwik";
type Props = {
onDragStart$?: PropFunction<() => void>;
onDragEnd$?: PropFunction<() => void>;
};
export const TileTemplate = component$<Props>(
({ onDragStart$, onDragEnd$ }) => {
return (
<div
draggable
onDragStart$={onDragStart$}
onDragEnd$={onDragEnd$}
class="cursor-pointer text-center text-white"
>
<Slot />
</div>
);
},
);
import { Slot, component$, $ } from "@builder.io/qwik";
import type { QRL } from "@builder.io/qwik";
type Props = {
onDragStart$?: QRL<() => void>;
onDragEnd$?: QRL<() => void>;
};
export const TileTemplate = component$<Props>(
({ onDragStart$, onDragEnd$ }) => {
return (
<div
draggable
onDragStart$={onDragStart$}
onDragEnd$={onDragEnd$}
class="cursor-pointer text-center text-white"
>
<Slot />
</div>
);
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment