score:1
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,
});
Source: stackoverflow.com
Related Query
- Redux Toolkit: How can I store a serialized action creator in state?
- How can you replace entire state in Redux Toolkit reducer?
- How can I cache data that I already requested and access it from the store using React and Redux Toolkit
- How can I store and subscribe component state to redux store?
- Redux Toolkit createEntityAdapter: how can i get current state of adapter?
- How to fire an action creator once a Redux state is updated
- How to dispatch action when a state changes in redux toolkit without using useEffect?
- React Redux - How to store form state so that it can be populated again when user returns to page
- How I can pass the state and action to Redux in functional component?
- How can I persist redux state tree on refresh?
- How to listen for specific property changes in Redux store after an action is dispatched
- How to reset state of Redux Store when using configureStore from @reduxjs/toolkit?
- How do I use local state along with redux store state in the same react component?
- How can I access state of another slice in redux with redux-toolkit?
- Redux - how to call an action creator from inside another action creator?
- Can a Redux action affect multiple parts of the state tree?
- How can I access current redux state from useEffect?
- How to mock store in redux toolkit
- how can we use redux state in useState to set initial values
- How do I test a Redux action creator that only dispatches other actions
- How to use useEffect hook properly with array dependency. I passed state from redux store and still my component renders infinitely
- How to indicate "loading" state for an async action during first render using redux
- Redux Toolkit w/ TypeScript: how can I properly type the return value from an async thunk
- How to use the updated value in redux store immediately after the action is dispatched in react js functional components
- How to wait for a Redux action to change state from a React component
- How can I initialize Redux state for React component on its creation?
- How can I persist React-native redux state using redux-persist?
- How to fetch data with multiple requests in Redux action creator and then send collected data to reducer?
- React Redux Toolkit: How can I can store my initialState to localStorage using createSlice?
- How to reset a redux slice state with Redux Toolkit (RTK)
More Query from same tag
- Find component element by name in jest enzyme
- I am getting empty array when I try to upload multiple images to my backend
- save array in state, and edit later
- How to over-ride React-Table default sort for date formats like 'MM-DD-YYYY' (07-22-2021)?
- How to use PostLogoutRedirectUris in reactjs?
- How to compare day in js
- Get the specific data (seatType: & seatTypeId:) from an Array React
- Logo does not change on scrolling using React
- How to server side redirect to other page without reloading the page and still keeping the url in Nextjs app?
- Styling third party elements with React inline styles
- A column in MUI Datatable do not hide or show based on a state true or false condition
- Received a promise that resolves to: undefined. Promise elements must resolve to a class or function
- How to dispatch actions via a timer using Redux
- React conditional action - useEffect vs an if statement
- bundle.js not found [Webpack]
- React - State set inside useEffect axios request is empty
- Material-UI Rating Component does not update star rating correctly
- React Hooks - Passing ref to child to use ScrollIntoView
- Conditionally making a number field required with YUP in React with react-hook-form
- Trouble with defaultSorted and React Bootstrap table Next
- Error: Objects are not valid as a React child (found: object with keys {}). use an array instead
- Flex grow not extending contents of div to fit full width of the div
- JsPDF: Error (Incomplete or corrupt png file)
- How to loop an object in React?
- Is it possible to include feature that depend on if the user as installed a certain package (optionalFeature)
- Conditional setInterval & clearInterval in ReactJS + Typescript
- How to implement multiple checkbox using react hook
- Send message to bot on click of menu item bot framework
- Reactjs var not defined inside a condition
- Using multiple react router switch throws 404 error