Questions tagged [Redux] (663)

0
answer

How to add a new value in the store using hook redux?

Here is my codeimport { createStore, combineReducers } from "redux"; const initalState2 = { counter: 0 }; function reducer2(state = initalState2, action) { console.log(state, "action"); switch (action.type) { case "INCREMENT": return { ...state, counter: state.counter + 1 }; case "DECREMENT": return { ...state, coun...
Linda2 asked March 31st 20 at 14:42
1
answer

Where to set connect if possible?

I need to when the answer came in the server was invoked action setUsersData. Where you need to register connect( null, mapDispatchToProps) that it was available in onmessage?import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { usersActions } from 'reducers'; const mapDispatchToProps...
Eden69 asked March 31st 20 at 14:22
5
answers

When not to use vuex | redux | flux?

Hello! The question arose, to use or not to use a library for state management at the level of the entire application. Scripts work with data in applications (spa or web?) may be different, but I divided by 2:First: we have some small amount of data, which is entirely loaded into the app, and we can save on the shared stora...
Raegan.Hansen asked March 31st 20 at 13:58
1
answer

How to sarchitecture action NGRX with two logical steps?

Companions help with a question on NGRX. There is such a structure Stora{ currentItem: 89, items: [77, 89, 99] } and you need to write this action: NavigateToFirst, the Result of which will be such as Stora:{ currentItem: 77, items: [77, 89, 99] } It's two operations, find first, to change the value. I can find the firs...
damaris asked March 30th 20 at 00:58
2
answers

How to update a single element in the Array in Redux?

There is an array of Messages.messages = [ { _id: "111", text: "text1" }, { _id: "222", text: "text2" }, ] In Redux during the action.case UPDATE_MESSAGE: let foundIndex = state.messages.findIndex(message => message ._id == payload._id); state.messages[foundIndex] = payload; return { ...state messages: [...state...
myrl_Sporer34 asked March 30th 20 at 00:40
1
answer

Why when testing reducer in the terminal error?

Welcome) Study testing. When testing reducer, the terminal falls error (Cannot read property 'wait' of undefined). Why? What's wrong? Help please :) Actionexport const GET_ACTIONS_REQUEST = "GET_ACTIONS_REQUEST"; export const GET_ACTIONS_SUCCESS = "GET_ACTIONS_SUCCESS"; const getActions = () => { return dispatch =>...
thaddeus_Rutherford asked March 30th 20 at 00:31
1
answer

React redux some action simultaneously?

Actually you need to update the store as the Redux to a certain condition, there are some action. They can consistently cause this: this.props.ChangeReportDetailShowAction(value); this.props.ChangeReportChildActiveAction(value); this.props.ChangeReportActiveAction(value); this.props.ChangeMapCenterAction(value); But all com...
Letha_Prohaska asked March 30th 20 at 00:11
1
answer

How does normalizr?

{ "id": "123", "author": { "id": "1", "name": "Paul" }, "title": "My awesome blog post", "comments": [ { "id": "324", "commenter": { "id": "2", "name": "Nicole" } } ] }import { normalize, schema } from 'normalizr'; // Define a users schema const user = new schema.Entity('users'); // Define your schema comments c...
Janelle.Schult asked March 29th 20 at 23:56
1
answer

What should soderjatsya in reducer'e or where to store functions?

Good time of day. App Nativ react with redoxon. There is a set of actions. There is a set of gears. Is a function that calls state changes, that is "action". Here like everything is clear. codeexport const endOrderCreateAction = (dispatch, orderStatus) => { return { type: END_ORDER_CREATE, orderStatus: orderStatus } }...
Jessy.Hartmann43 asked March 29th 20 at 23:36
2
answers

Not updated after the component props, why?

Hello, is the code that receives some goods in propse. When you press the button 'add product' then it adds it to cart redux. When you add everything works fine, however the problem with deleting from the recycle bin. Deleted items disappear from the interface only when you will add a new item By redaxo everything seems to ...
grover_Casp asked March 29th 20 at 23:17