2. **Add a Custom Component**
Drag and drop a Custom Component onto the canvas.
Set the *Data* property as:
```js
{{
{ title: 'Todos', buttonText: 'Get Todo', queryData: queries.getIndividualTodo.data}
}}
```
This passes the title, button text, and query data to the Custom Component.
3. **Add the Component Code**
Paste the following into the *Code* property:
```js
import React, { useState, useEffect } from 'https://cdn.skypack.dev/react';
import ReactDOM from 'https://cdn.skypack.dev/react-dom';
import { Button, Container, TextField, Typography } from 'https://cdn.skypack.dev/@material-ui/core';
const MyCustomComponent = ({ data, updateData, runQuery }) => {
const [todoId, setTodoId] = useState(1);
const fetchTodo = async () => {
try {
const { data: todo } = await runQuery('getIndividualTodo', { id: todoId });
if (todo) updateData({ ...data, queryData: todo });
} catch (error) {
console.error("Error fetching todo:", error);
}
};
return (
ID: {data.queryData.id}
Title: {data.queryData.title}
Completed: {data.queryData.completed ? "Yes" : "No"}
4. **Fetch the Todo**
Now, when you click the **Fetch Todo** button, the *getIndividualTodo* query will run with the Todo ID passed as a parameter and return the details of the Todo.
:::note
In a typical JavaScript query, parameters are passed in a manner similar to a standard function call. For example, you can specify the parameters for the query using `queries.getIndividualTodo.run({ id: 2 })`
:::