Search code examples
reactjsreact-reduxreact-query

Is the order of react-query QueryClientProvider and react-redux Provider important?


Which is recommended?

Is the order irrelevant?

<QueryClientProvider client={queryClient}>
    <Provider store={store}>
        stuff
    </Provider>
</QueryClientProvider>

or

<Provider store={store}>
    <QueryClientProvider client={queryClient}>  
        stuff
    </QueryClientProvider>
</Provider>

Solution

  • The order is not relevant because neither Provider need to access things from the other Provider (redux doesn't need access to the QueryClient and react-query doesn't need access to the redux store)