import { run } from './run.js' import { useQuery } from '@tanstack/react-query' import { useState } from 'react' // @ts-ignore - TODO make a ts plugin TODO make a global .t.sol module type import PureQuery from './PureQuery.s.sol' export const Pure = () => { const [num1, setNum1] = useState(0) const [num2, setNum2] = useState(0) const { data, error, isLoading } = useQuery( [PureQuery.id, num1, num2], async () => { return run(PureQuery, [num1, num2]) }, ) return (
Testing a pure query
This pure script does not read/write to state
This is testing that the vm is executing
Change the inputs and a query will execute
setNum1(Number(e.target.value))} />{' '} + setNum2(Number(e.target.value))} />{' '} =
{data}
{error &&
{JSON.stringify(error)}
} {isLoading &&
Loading...
}
) }