Answer the question
In order to leave comments, you need to log in
How to work with props if you use immutable js in conjunction with redux?
Let's say there is a store
const initState = Immutable.fromJS({
data: [],
});
export default function reducer(state = initState, action) {
switch (action.type) {
case actions.SET_DATA: {
const { payload } = action;
return state.merge({ data: payload })
}
const Component = (props) => {
const { data } = props;
return {
<div> data </div>
}
}
const mapStateToProps = (state) => {
data: state.data || state.data.toJS()
}
Component.defaultValue = {
data: ??????
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question