Some way to use a custom compose
function with configureStore
#4358
matt-oakes
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
Ultimately all that Pretty sure you should be able to do something like: configureStore({
reducer,
devTools: false,
enhancers: (getDefaultEnhancers) => {
return getDefaultEnhancers().concat(yourSpecialEnhancerHere)
}
}) Does that work? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Firstly, thanks for all your work on Redux Toolkit. It makes setting up Redux much easier, especially with slices.
Issue
I am working on adding support for a custom version of the Redux DevTools for Expo/React Native using their dev plugin system. I have already created a first version of this and it's working well.
Hooking it up to Redux is very similar to
@redux-devtools/remote
where is requires you to add a new enhancer. The catch though, is that as with DevTools remote, if you have other enhancers or middleware then it requires you to wrap those in acomposeWithDevTools
.For standard Redux using
createStore
, this works fine.The issue is that Toolkits
configureStore
does not currently have a way to do this, so your only option is to manually configure everything usingcreateStore
, which isn't a great solution.Solution
My idea for a solution is to allow you to pass in a new
compose
property. This will be used in place of Redux's compose function and would allow users to pass in thecomposeWithDevTools
from my library (different from the standard Redux DevTools one).One issue that we might have is that
finalCompose
is changed based on thedevTools
property. As this isn't desireable, what I propose is that you need to explicitly setdevTools: false
to be able to supply acompose
property.For example, this would be invalid and throw an error/warning (due to
devTools: true
being the default):wheras this would be valid:
Changes needed
compose
property toConfigureStoreOptions
configureStore
I would be happy to make these changes as they don't seem too big, but I wanted to get the go ahead that this solution is something you would be happy with before starting on it.
Let me know if you have any questions or comments.
Beta Was this translation helpful? Give feedback.
All reactions