Skip to content

How to define actions at module level, external to the store when using Next.js store configurations? #2454

Closed Answered by dbritto-dev
adam-ridhwan asked this question in Q&A
Discussion options

You must be logged in to vote

@karangarg45 actually, it's possible but you need to pass the store to your store action.

incrementBearCount(bearStore)

The implementation would be something like this:

const incrementBearCount = store => {
  store.getState().incrementBearCount()
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@karangarg45
Comment options

@dbritto-dev
Comment options

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