score:1

Accepted answer

to be honest, this is a bad idea, and really not at all how redux should be used.

based on the examples, it looks like you're trying to create a modal and pass in a callback as a prop. there are other ways to do this that will work better with redux, and in fact a few years ago i wrote a post on managing modals and context menus with redux. it shows a few different techniques to do this in a way that is compatible with how redux should be used.

today, the option i'd recommend is using a custom middleware that tracks what modals are open, returns a promise from dispatch(showmodal()), and resolves the promise when you do dispatch(closemodal(modalid)).

the post links to https://github.com/akolodeev/redux-promising-modals as one option for this. i also have an incomplete but mostly working similar implementation in a gist at https://gist.github.com/markerikson/8cd881db21a7d2a2011de9e317007580 that shows some of the potential approaches.

score:0

you can disable the serializablecheck like below

import {getdefaultmiddleware} from "@reduxjs/toolkit";
const custommiddleware = getdefaultmiddleware({
  serializablecheck: false,
});

export default configurestore({
reducer: {
...your reducers
},
 middleware: custommiddleware,
});

Related Query

More Query from same tag