Skip to content
Discussion options

You must be logged in to vote

Make the test component render a button with an onClick handler that calls setQueryData. Then, interact with the button and click it via testing-library:

<button onClick={() => queryClient.setQueryData(...)}>set data</button>

fireEvent.click(getByRole('button', { name: /set data/i }))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@david-abell
Comment options

Answer selected by david-abell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants