Please understand that I am not fluent in English.
How can I use 'useQuery' as a callback function for a click event in React?
The error contents are as follows. 'Error: Invalid hook call. Hooks can only be called inside of the body of a function component.'
const createGuestBookWrite = () => {
const { data, error } = useQuery(GuestApi.ACTIONS.CREATE_GUEST_BOOK, async () => {
return await GuestApi.fetchGuestBookWrite({
spaceUid: 2,
bookText: content,
});
});
console.log('data::::::::::', data);
};
<span onClick={createGuestBookWrite}>
<TextButton textID={I18N_CODE.GUESTBOOK_NEW_PUBLICATION}></TextButton>
</span>