From 777d32af0ec03ddb4cc9cb54165c038f641a9683 Mon Sep 17 00:00:00 2001 From: Mark Rickert Date: Wed, 13 Dec 2023 13:34:29 -0700 Subject: [PATCH] chore(docs): Update redux to add section about RTK Closes #1323 Thank you for your contribution, @shoaib2527! --- docs/plugins/redux.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/plugins/redux.md b/docs/plugins/redux.md index 617255bc6..ffab9df13 100644 --- a/docs/plugins/redux.md +++ b/docs/plugins/redux.md @@ -58,7 +58,22 @@ ReactotronConfig, you'll need to add `reactotron-redux` as plugin + export default reactotron ``` -Then, add enhancer from `Reactotron.createEnhancer()` to `createStore` as last parameter +## Using Redux Toolkit (RTK) + +If you're using RTK, add the enhancer from `Reactotron.createEnhancer()` to `enhancers` in `configureStore` + +```diff +import {configureStore} from '@reduxjs/toolkit'; ++ import Reactotron from './ReactotronConfig' +const store = configureStore({ + ... (reducers, middlewares etc), ++ enhancers: __DEV__ ? [Reactotron.createEnhancer!()] : [], +}); +``` + +## Using Classic Redux + +Add enhancer from `Reactotron.createEnhancer()` to `createStore` as last parameter ```diff import { createStore } from 'redux' @@ -71,7 +86,7 @@ import { createStore } from 'redux' Note: passing enhancer as last argument requires redux@>=3.1.0 -## If you have middleware +### If you have middleware ```diff import { createStore } from 'redux'