Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify state in Redux DevTools Extension

In my application state there are values set as initialState.

With the React Developer Tools it's very easy to directly modify some state value.

Is anything similar possible in Redux DevTools Extension, i.e. click and insert a new value for a specific property?

In this SO anwer it's stated that it's possible to "change whatever you want", but I cannot find how.

In the State -> Raw pane (see pic below) one can overwrite values but it doesn't seem to be applied.

enter image description here

like image 260
Fellow Stranger Avatar asked Dec 18 '17 00:12

Fellow Stranger


People also ask

What does Redux DevTools extension do?

What is the Redux DevTool extension? DevTool is a Chrome-based extension that provides a console where we can set up our development environment with Redux. This extension helps in visualizing the actions and state changes that generally occur in a Redux-based application.

Can a user change Redux state?

No – it is not currently possible to manually modify the state. See this issue in the Redux DevTools repository; the maintainer does intend to implement the feature eventually: I'll implement it after 3.0, when will finish extension's rewriting and new UI.

How do I see Redux state in Chrome?

From the navigation bar within the Chrome developer tools, you can find the Redux DevTools by selecting the new Redux panel, made available by the Redux DevTools Chrome extension (figure 3.5).


2 Answers

You can cause an action to dispatch that updates your object (or you can type it by hand, whichever is easier for you) and then you can cause a new dispatch straight from the tool with the following button

Screenshot of Redux Tools

for example, if you wish to simulate the server returned an object in a different state, just dispatch the action that updated the object again with the modified fields.

like image 69
Vnvizitiu Avatar answered Sep 21 '22 12:09

Vnvizitiu


No – it is not currently possible to manually modify the state.

See this issue in the Redux DevTools repository; the maintainer does intend to implement the feature eventually:

I'll implement it after 3.0, when will finish extension's rewriting and new UI. Additionally to states, the plan is also to edit dispatched actions, changing the payloads. And, if there's interest, duplicating actions; so after editing would be 2 options to overwrite the current one (and recompute states) or dispatch as a new action.

like image 26
ash Avatar answered Sep 24 '22 12:09

ash