Which is Best .toJS() vs .toJSON() in immutable js?

Viewed 4647

I am new to React+Redux+Immutable js ,I am using toJS() to tranforming my Immutable Data structure to Native javascript form.But Recently I stumbleupon with this tweet

Author of Immutable.Js

Tweet says .toJS() is very expensive So can i go with toJSON() https://facebook.github.io/immutable-js/docs/#/List/toJSON is it ok with perf issue

UPDATE

const initialState = fromJS({
   postArr:[]
});

    const mapStateToProps = (state) => {
        return{
            posts:state.allPosts.toJS()
        }
    };

Pls provide some example with my own Reducer

How can i iterate this.props.posts without using to.js()

1 Answers
Related