Skip to content
Discussion options

You must be logged in to vote

Does defining the dispatcher above SWRConfiguration work for you? like

const showLoading = useDisplayState(state => state.activateLoader)
export const SWRGlobalConfig = {
  onLoadingSlow: () => { showLoading(); },
  // ...

You cannot use hooks inside those callbacks since they're just callbaks triggered on state change, which is outside of react render scope.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@huozhi
Comment options

@Jerryhu1
Comment options

@nielskrijger
Comment options

@huozhi
Comment options

@Jerryhu1
Comment options

Answer selected by Jerryhu1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants