You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
i have a simple hook component that looks like this
export function DownloadTestData(props) {
const [getTestData, { loading, error, data }] = useLazyQuery(QUERY_TEST);
if (data)
saveAsCsv(data)
return <Button onClick={getTestData}>export</Button>
it works as expected, except, when the row that contains DownloadTestData component get's re-rendered, it re-runs above function with data still available, so the save executes multiple times (once on click, and all subsequent re-renders of that component)
am i using it incorrectly?
how come data remains populated on subsequent re-renders? i need it to trigger only once when getTestData was executed
data is also there for all useEffect hooks subsequent to onClick action.
The text was updated successfully, but these errors were encountered:
i have a simple hook component that looks like this
it works as expected, except, when the row that contains
DownloadTestData
component get's re-rendered, it re-runs above function withdata
still available, so the save executes multiple times (once on click, and all subsequent re-renders of that component)am i using it incorrectly?
how come data remains populated on subsequent re-renders? i need it to trigger only once when getTestData was executed
data
is also there for all useEffect hooks subsequent to onClick action.The text was updated successfully, but these errors were encountered: