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

Method render

examples/lit/basic/src/mutation.ts:86–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84 }
85
86 render() {
87 const query = this.todos()
88 const mutation = this.addTodo()
89 const items = query.data?.items ?? []
90
91 return html`
92 <main>
93 <h1>Mutation Example</h1>
94 <p data-testid="mutation-query-status">
95 Query: <strong>${query.status}</strong>
96 </p>
97 <p data-testid="mutation-mutation-status">
98 Mutation: <strong>${mutation.status}</strong>
99 </p>
100
101 <label for="title">Todo title</label>
102 <input
103 id="title"
104 data-testid="mutation-input"
105 .value=${this.nextTitle}
106 @input=${this.onInput}
107 />
108 <button data-testid="mutation-add" @click=${this.submit}>
109 Add Todo
110 </button>
111
112 <ul data-testid="mutation-todo-list">
113 ${items.map(
114 (todo) =>
115 html`<li data-testid="mutation-todo-item">${todo.title}</li>`,
116 )}
117 </ul>
118 </main>
119 `
120 }
121}
122
123customElements.define('mutation-example', MutationExample)

Callers

nothing calls this directly

Calls 1

addTodoMethod · 0.80

Tested by

no test coverage detected