react-redux

Getting an error “A non-serializable value was detected in the state” when using redux toolkit - but NOT with normal redux

守給你的承諾、 提交于 2020-11-28 04:39:40
问题 I am trying to switch an app I am building over to use Redux Toolkit, and have noticed this error coming up as soon as I switched over to configureStore from createStore: A non-serializable value was detected in the state, in the path: `varietals.red.0`. Value:, Varietal { "color": "red", "id": "2ada6486-b0b5-520e-b6ac-b91da6f1b901", "isCommon": true, "isSelected": false, "varietal": "bordeaux blend", }, Take a look at the reducer(s) handling this action type: TOGGLE_VARIETAL. (See https:/

react.js constructor called twice

﹥>﹥吖頭↗ 提交于 2020-11-24 17:08:19
问题 I a have post list and I am trying to call an action inside of constructor or componentDidMount for each post. But somehow when I send a new message constructor and componentDidMount functions are called twice. constructor(props) { super(props); if (condition1) { this.props.actions.action1(); } else if (condition2) { this.props.actions.action2(); } } These functions are called only once when the posts are readed from a list. But when I send a new message they are called twice. How can i avoid