MCPcopy Create free account
hub / github.com/TanStack/query / render

Method render

examples/lit/basic/src/basic-query.ts:41–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 }
40
41 render() {
42 const query = this.todos()
43 return html`
44 <main>
45 <h1>Basic Query Example</h1>
46 <p data-testid="basic-query-status">
47 Status: <strong>${query.status}</strong>
48 </p>
49 <button
50 data-testid="basic-refetch"
51 @click=${() => this.todos.refetch()}
52 >
53 Refetch
54 </button>
55
56 ${query.isPending
57 ? html`<p data-testid="basic-loading">Loading...</p>`
58 : null}
59 ${query.isError
60 ? html`<p data-testid="basic-error">Error: ${String(query.error)}</p>`
61 : null}
62
63 <ul data-testid="basic-todo-list">
64 ${(query.data?.items ?? []).map(
65 (todo) =>
66 html`<li data-testid="basic-todo-item">${todo.title}</li>`,
67 )}
68 </ul>
69 </main>
70 `
71 }
72}
73
74customElements.define('basic-query-example', BasicQueryExample)

Callers

nothing calls this directly

Calls 1

refetchMethod · 0.80

Tested by

no test coverage detected