Hello, can anyone help me with this code, it still uses useClientEffect$.
import { component$, useClientEffect$, useStore } from “@builder.io/qwik”;
import { DocumentHead, Link } from “@builder.io/qwik-city”;
import { Post } from “@prisma/client”;
import { trpc } from “~/client/trpc”;
export default component$(() => {
const store = useStore({
query: “”,
results: as Post,
});
useClientEffect$(async ({ track, cleanup }) => {
const controller = new AbortController();
cleanup(() => controller.abort());
const query = track(store, "query");
const posts = await trpc.posts.getPosts.query({ query }, { signal: controller.signal });
store.results = posts;
});
return ( rest of code..
Can anyone change this code to be compatible with the latest version of Qwik. This code works in the old “@builder.io/qwik”: “0.9.0” version but not in recent versions. What would be the correct way to do this now? Meaning a production ready version like 1.0.0 or later.
Maby a easy question for you but i am struggling to make this work