Closed Jbarget closed 8 years ago
The state my components are receiving are still in the Immutable.js form.
Thats expected.
You can either use instances of Immutabe.js in your components as you have received them, or you can convert them to plain objects in the (since you are using Redux) mapStateToProps
callback.
oh gotcha! would you be able to point me to whats the best way of doing that as i've read toJS()
isnt that performant
oh gotcha! would you be able to point me to whats the best way of doing that as i've read toJS() isnt that performant
There is nothing wrong with using toJS
in this scenario. (As long as you limit the scope of selected data to only whats needed and not the entire state.)
Please close the issue if it answers your question.
it certainly does! really appreciate it!
although just tried this:
const mapStateToProps = (state) => {
return {
loginRehydrated: state.get('login').toJS().rehydrated
};
};
and getting Uncaught TypeError: state.get is not a function
last thing :)
and getting Uncaught TypeError: state.get is not a function last thing :)
This is unrelated to the original question and outside of the redux-immutable
scope. Refer to Immutable.js documentation.
👍 thanks again
(I would start by inspecting state
value, and tracing its origin, since it doesn't look like it is an instance of Immutable
).
@Jbarget I've got the same problem Uncaught TypeError: state.get is not a function
did you find a solution?
Our front-end architecture changed so we didnt need to add immutable state management. My original problem was that I wasn't accessing my state correctly
@Jbarget Thanks for your answer.
@gajus 在redux-immutable
里是否对set
方法进行了特殊处理从而在组件里可以获取到JS Object?而merge
方法没有进行特殊处理?
Hey there, just trying to convert a current app to deal with immutable state and running into some troubles. The state my components are receiving are still in the Immutable.js form.
Any help will be great as I cant seem to figure out where exactly im going wrong although I think its the way im orgainsing
configureStore.js
below. (I've taken the majority of the app out for simplicity)thanks
reducer.js:
combineReducers.js:
configureStore.js:
index.js: