Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Post() {
const [id, setId] = useState('')
const [getPosts, { error, data }] = useManualQuery(postQuery)
async function handleSubmit(e: any) {
e.preventDefault()
await getPosts({ variables: { id } })
}
return (
<>
<h2>Search by ID</h2>
<form>
<label>ID:</label>
<input required="" value="{id}"> setId(e.currentTarget.value)}</form>
const useSearchManager = (initialMeasures, initialRegions) => {
const [fetchSchema] = useManualQuery(SCHEMA_QUERY)
const [fetchRegion] = useManualQuery(REGION_QUERY)
const asyncActions = useMemo(
() => ({
syncUrl: () => async (dispatch, getState) => {
Router.push({
pathname: '/statistics',
query: stateToQueryArgs(getState())
})
},
loadMeasure: id => async dispatch => {
const [statisticId, measureId] = id.split(':')
dispatch(actions.setLoading())
const schema = await fetchSchema({
variables: {
measures: [{ statisticId, measureId }]
const useSearchManager = (initialMeasures, initialRegions) => {
const [fetchSchema] = useManualQuery(SCHEMA_QUERY)
const [fetchRegion] = useManualQuery(REGION_QUERY)
const asyncActions = useMemo(
() => ({
syncUrl: () => async (dispatch, getState) => {
Router.push({
pathname: '/statistics',
query: stateToQueryArgs(getState())
})
},
loadMeasure: id => async dispatch => {
const [statisticId, measureId] = id.split(':')
dispatch(actions.setLoading())
const schema = await fetchSchema({
variables: {
measures: [{ statisticId, measureId }]
}
function HomePage() {
const [name, setName] = React.useState('')
const { loading, data, error, refetch: refetchUsers } = useQuery(
HOMEPAGE_QUERY
)
const [createUser] = useMutation(CREATE_USER_MUTATION)
const [getFirstUser, { data: firstUserData }] = useManualQuery(
GET_FIRST_USER_QUERY,
{
fetchOptionsOverrides: {
method: 'GET'
}
}
)
async function createNewUser() {
await createUser({ variables: { name } })
setName('')
refetchUsers()
}
return (
<div></div>